Class FpNumber


  • public final class FpNumber
    extends java.lang.Object
    FpNumber represents a floating point number with an arbitrary precision (less or equal to double).
    • Constructor Summary

      Constructors 
      Constructor Description
      FpNumber​(FpFormat format, long bits)
      Constructs a floating-point number.
      FpNumber​(FpFormat format, long sign, long exponent, long fraction)
      Constructs a floating-point number.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      FpNumber clone()  
      boolean equals​(java.lang.Object o)  
      long getBits()
      Returns the bits representing of the floating-point number.
      long getExponent()
      Returns the exponent of the floating-point number.
      FpFormat getFormat()
      Returns the format of the floating-point number.
      long getFraction()
      Returns the fraction of the floating-point number.
      long getSign()
      Returns the sign of the floating-point number.
      int hashCode()  
      boolean isInfinity()
      Checks whether the floating-point number is infinity.
      boolean isMinusInfinity()
      Checks whether the floating-point number is minus infinity.
      boolean isMinusZero()
      Checks whether the floating-point number is minus zero.
      boolean isNaN()
      Checks whether the floating-point number is non-a-number (NaN).
      boolean isNormalized()
      Checks whether the floating-point number is normalized.
      boolean isPlusInfinity()
      Checks whether the floating-point number is plus infinity.
      boolean isPlusZero()
      Checks whether the floating-point number is plus zero.
      boolean isZero()
      Checks whether the floating-point number is zero.
      void setBits​(long bits)
      Sets the bits representation of the floating-point number.
      void setExponent​(long exponent)
      Sets the exponent of the floating-point number.
      void setFraction​(long fraction)
      Sets the fraction of the floating-point number.
      void setSign​(long sign)
      Sets the sign of the floating-point number.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • FpNumber

        public FpNumber​(FpFormat format,
                        long sign,
                        long exponent,
                        long fraction)
        Constructs a floating-point number.
        Parameters:
        format - the format.
        sign - the sign.
        exponent - the exponent.
        fraction - the fraction.
      • FpNumber

        public FpNumber​(FpFormat format,
                        long bits)
        Constructs a floating-point number.
        Parameters:
        format - the format.
        bits - the bits representing the number.
    • Method Detail

      • getFormat

        public FpFormat getFormat()
        Returns the format of the floating-point number.
        Returns:
        the floating-point number format.
      • getSign

        public long getSign()
        Returns the sign of the floating-point number.
        Returns:
        the floating-point number sign.
      • getExponent

        public long getExponent()
        Returns the exponent of the floating-point number.
        Returns:
        the floating-point number exponent.
      • getFraction

        public long getFraction()
        Returns the fraction of the floating-point number.
        Returns:
        the floating-point number fraction.
      • setSign

        public void setSign​(long sign)
        Sets the sign of the floating-point number.
        Parameters:
        sign - the sign to be set.
      • setExponent

        public void setExponent​(long exponent)
        Sets the exponent of the floating-point number.
        Parameters:
        exponent - the exponent to be set.
      • setFraction

        public void setFraction​(long fraction)
        Sets the fraction of the floating-point number.
        Parameters:
        fraction - the fraction to be set.
      • getBits

        public long getBits()
        Returns the bits representing of the floating-point number.
        Returns:
        the bits representing the floating-point number.
      • setBits

        public void setBits​(long bits)
        Sets the bits representation of the floating-point number.
        Parameters:
        bits - the bits to be set.
      • isZero

        public boolean isZero()
        Checks whether the floating-point number is zero.
        Returns:
        true if the number is zero; false otherwise.
      • isPlusZero

        public boolean isPlusZero()
        Checks whether the floating-point number is plus zero.
        Returns:
        true if the number is plus zero; false otherwise.
      • isMinusZero

        public boolean isMinusZero()
        Checks whether the floating-point number is minus zero.
        Returns:
        true if the number is minus zero; false otherwise.
      • isInfinity

        public boolean isInfinity()
        Checks whether the floating-point number is infinity.
        Returns:
        true if the number is infinity; false otherwise.
      • isPlusInfinity

        public boolean isPlusInfinity()
        Checks whether the floating-point number is plus infinity.
        Returns:
        true if the number is plus infinity; false otherwise.
      • isMinusInfinity

        public boolean isMinusInfinity()
        Checks whether the floating-point number is minus infinity.
        Returns:
        true if the number is minus infinity; false otherwise.
      • isNaN

        public boolean isNaN()
        Checks whether the floating-point number is non-a-number (NaN).
        Returns:
        true if the number is NaN; false otherwise.
      • isNormalized

        public boolean isNormalized()
        Checks whether the floating-point number is normalized.
        Returns:
        true if the value is normalized; false otherwise.
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • clone

        public FpNumber clone()
        Overrides:
        clone in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object