Class RawQuad

  • All Implemented Interfaces:
    Serializable

    public class RawQuad
    extends Number
    An immutable POF 128-bit float.
    Since:
    Coherence 3.2
    Author:
    cp 2006.07.17
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static RawQuad ZERO
      An empty RawQuad value.
    • Constructor Summary

      Constructors 
      Constructor Description
      RawQuad​(double dfl)
      Construct a RawQuad from a double.
      RawQuad​(Binary binBits)
      Construct a RawQuad from the raw binary data.
      RawQuad​(BigInteger nUnscaledValue, int nScale)
      Construct a RawQuad from an unscaled integer value and a scale.
    • Field Detail

      • ZERO

        public static final RawQuad ZERO
        An empty RawQuad value.
    • Constructor Detail

      • RawQuad

        public RawQuad​(Binary binBits)
        Construct a RawQuad from the raw binary data.
        Parameters:
        binBits - the raw binary form of the 128-bit float
      • RawQuad

        public RawQuad​(double dfl)
        Construct a RawQuad from a double.
        Parameters:
        dfl - the double value
      • RawQuad

        public RawQuad​(BigInteger nUnscaledValue,
                       int nScale)
        Construct a RawQuad from an unscaled integer value and a scale.
        Parameters:
        nUnscaledValue - the unscaled value (mantissa)
        nScale - the scale (exponent)
    • Method Detail

      • intValue

        public int intValue()
        Returns the value of the specified number as an int. This may involve rounding or truncation.
        Specified by:
        intValue in class Number
        Returns:
        the numeric value represented by this object after conversion to type int.
      • longValue

        public long longValue()
        Returns the value of the specified number as a long. This may involve rounding or truncation.
        Specified by:
        longValue in class Number
        Returns:
        the numeric value represented by this object after conversion to type long.
      • floatValue

        public float floatValue()
        Returns the value of the specified number as a float. This may involve rounding.
        Specified by:
        floatValue in class Number
        Returns:
        the numeric value represented by this object after conversion to type float.
      • doubleValue

        public double doubleValue()
        Returns the value of the specified number as a double. This may involve rounding.
        Specified by:
        doubleValue in class Number
        Returns:
        the numeric value represented by this object after conversion to type double.
      • getBits

        public Binary getBits()
        Obtain the raw binary form of the 128-bit float.
        Returns:
        a 16-byte binary
      • unscaledValue

        public BigInteger unscaledValue()
        Get the base-2 unscaled value (mantissa) of the quad value.

        The name of this method is based on Java's BigDecimal.

        Returns:
        an unscaled binary integer value of up to 113 binary digits
      • scale

        public int scale()
        Get the base-2 scale (exponent) of the quad value.

        The name of this method is based on Java's BigDecimal.

        Returns:
        a binary exponent between -16382 to 16383 inclusive
      • equals

        public boolean equals​(Object o)
        Compare this object with another for equality.
        Overrides:
        equals in class Object
        Parameters:
        o - another object to compare to for equality
        Returns:
        true iff this object is equal to the other object
      • hashCode

        public int hashCode()
        Obtain the hashcode for this object.
        Overrides:
        hashCode in class Object
        Returns:
        an integer hashcode
      • toString

        public String toString()
        Format this object's data as a human-readable string.
        Overrides:
        toString in class Object
        Returns:
        a string description of this object