Package com.io7m.ieee754b16
Class Binary64
java.lang.Object
com.io7m.ieee754b16.Binary64
Utility functions related to the binary64 format specified in
IEEE 754 2008.
-
Method Summary
Modifier and TypeMethodDescriptionstatic longunpackGetExponentUnbiased(double d) Extract and unbias the exponent of the given packeddoublevalue.static longunpackGetSign(double d) Retrieve the sign bit of the given floating point value, as an integer.static longunpackGetSignificand(double d) Return the significand of the given floating point value as an integer.
-
Method Details
-
unpackGetExponentUnbiased
public static long unpackGetExponentUnbiased(double d) Extract and unbias the exponent of the given packed
doublevalue.The exponent is encoded biased as a number in the range
[0, 2047], with0indicating that the number is subnormal and[1, 2046]denoting the actual exponent plusBIAS. Infinite andNaNvalues always have a biased exponent of2047.This function will therefore return:
-
0 -iff the input is a subnormal number.BIAS= -1023 - An integer in the range
[1 -iff the input is a normal number.BIAS, 2046 -BIAS] = [-1022, 1023] -
2047 -iff the input isBIAS= 1024Double.POSITIVE_INFINITY,Double.NEGATIVE_INFINITY, orNaN.
- Parameters:
d- A floating point value- Returns:
- An unbiased exponent
-
-
unpackGetSign
public static long unpackGetSign(double d) Retrieve the sign bit of the given floating point value, as an integer.- Parameters:
d- A floating point value- Returns:
- An unpacked sign bit
-
unpackGetSignificand
public static long unpackGetSignificand(double d) Return the significand of the given floating point value as an integer.
- Parameters:
d- A floating point value- Returns:
- An unpacked significand
- See Also:
-