| Modifier and Type | Field and Description |
|---|---|
static int |
MAX_EXPONENT
The largest permitted exponent value, when using an exponent with offset.
|
static int |
MAX_EXPONENT_BITS
The largest permitted exponent value, when using raw exponent bits.
|
static long |
MAX_MANTISSA
The largest permitted mantissa value.
|
static int |
MIN_EXPONENT
The smallest permitted exponent value, when using an exponent with offset.
|
| Modifier and Type | Method and Description |
|---|---|
static long[] |
getAllParts(double d)
Returns an array containing the parts of the double.
|
static long[] |
getAllParts(double d,
boolean exponentAsBits)
Returns an array containing the parts of the double.
|
static double |
getDouble(int sign,
int exponent,
long mantissa)
Creates a new double primitive using the provided component bits.
|
static double |
getDouble(int sign,
int exponent,
long mantissa,
boolean exponentAsBits)
Creates a new double primitive using the provided component bits.
|
static int |
getExponent(double d)
Returns the exponent, after adding the exponent offset to the exponent bits.
|
static int |
getExponentBits(double d)
Returns the raw exponent bits, without adjusting for the offset.
|
static long |
getMantissa(double d)
Returns the mantissa bits (bits 51-0).
|
static int |
getSign(double d)
Returns the sign bit (bit 63).
|
static boolean |
isFinite(double d)
Returns true if d is finite--not infinite and not NaN.
|
static boolean |
isSubnormal(double d)
Returns whether or not this double is a subnormal value.
|
public static final long MAX_MANTISSA
public static final int MAX_EXPONENT_BITS
public static final int MIN_EXPONENT
public static final int MAX_EXPONENT
public static boolean isFinite(double d)
d - a double valuepublic static int getSign(double d)
d - a double valuepublic static int getExponent(double d)
getExponent(0.5) == -1 because 1.0 == 1.0 * 2^-1getExponent(1.0) == 0 because 1.0 == 1.0 * 2^0getExponent(2.0) == 1 because 2.0 == 1.0 * 2^1d - any double valuepublic static int getExponentBits(double d)
getExponentBits(0.5) == 0x3fegetExponentBits(1.0) == 0x3ffgetExponentBits(2.0) == 0x400d - a double valuepublic static long getMantissa(double d)
d - a double valuepublic static boolean isSubnormal(double d)
d - a double valuepublic static long[] getAllParts(double d)
d - a double valuepublic static long[] getAllParts(double d,
boolean exponentAsBits)
d - a double valueexponentAsBits - whether to return exponent as raw bits rather than adjusted valuepublic static double getDouble(int sign,
int exponent,
long mantissa)
sign - sign bitexponent - adjusted exponentmantissa - mantissa bitsIllegalArgumentException - if any of the parts contain invalid bits.public static double getDouble(int sign,
int exponent,
long mantissa,
boolean exponentAsBits)
sign - sign bitexponent - exponent (either raw bits or adjusted value)mantissa - mantissa bitsexponentAsBits - If true, assumes that exponent parameter represents the actual exponent bits. If false,
IEEE exponent offset value will be added to the offset to get the bits.IllegalArgumentException - if any of the parts contain invalid bits.