Class RawQuad

java.lang.Object
java.lang.Number
com.tangosol.io.pof.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:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final RawQuad
    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.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    Returns the value of the specified number as a double.
    boolean
    Compare this object with another for equality.
    float
    Returns the value of the specified number as a float.
    Obtain the raw binary form of the 128-bit float.
    int
    Obtain the hashcode for this object.
    int
    Returns the value of the specified number as an int.
    long
    Returns the value of the specified number as a long.
    int
    Get the base-2 scale (exponent) of the quad value.
    Format this object's data as a human-readable string.
    Get the base-2 unscaled value (mantissa) of the quad value.

    Methods inherited from class java.lang.Number

    byteValue, shortValue

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • ZERO

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

    • 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 Details

    • 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