Class FloatingPointNumber


  • @Immutable
    public abstract class FloatingPointNumber
    extends Object
    Represents a floating-point number with customizable precision, consisting of sign, exponent, and mantissa components.
    • Field Detail

      • SINGLE_PRECISION_EXPONENT_SIZE

        public static final int SINGLE_PRECISION_EXPONENT_SIZE
        See Also:
        Constant Field Values
      • SINGLE_PRECISION_MANTISSA_SIZE

        public static final int SINGLE_PRECISION_MANTISSA_SIZE
        See Also:
        Constant Field Values
      • DOUBLE_PRECISION_EXPONENT_SIZE

        public static final int DOUBLE_PRECISION_EXPONENT_SIZE
        See Also:
        Constant Field Values
      • DOUBLE_PRECISION_MANTISSA_SIZE

        public static final int DOUBLE_PRECISION_MANTISSA_SIZE
        See Also:
        Constant Field Values
    • Constructor Detail

      • FloatingPointNumber

        public FloatingPointNumber()
    • Method Detail

      • getSign

        public abstract boolean getSign()
        Whether the number is positive (TRUE) or negative (FALSE).
      • getExponent

        public abstract BigInteger getExponent()
        The exponent of the floating-point number, given as numeric value.
      • getMantissa

        public abstract BigInteger getMantissa()
        The mantissa (aka significand) of the floating-point number, given as numeric value.
      • getExponentSize

        public abstract int getExponentSize()
      • getMantissaSize

        public abstract int getMantissaSize()
      • floatValue

        public float floatValue()
        compute a representation as Java-based float value, if possible.
      • doubleValue

        public double doubleValue()
        compute a representation as Java-based double value, if possible.
      • toString

        public final String toString()
        Return a bit-representation of sign-bit, exponent, and mantissa, i.e., a concatenation of their bit-representations in this exact ordering.
        Overrides:
        toString in class Object