Class ExtendedReal
- All Implemented Interfaces:
Serializable
An extended-real number uses 80 bits to represent a floating point number. It is able to represent numbers ranging from 3.37*10^-4932 up to 1.18*10^4932.
Bit layout
79 78-64 63 62-0
Sign Biased Exponent Integer Fraction
For the single-real and double-real formats, only the fraction part of the significand is encoded. The integer is assumed to be 1 for all numbers except 0 and denormalized finite numbers. For the extended-real format, the integer is contained in bit 64, and the most significant fraction bit is bit 62. Here, the integer is explicitly set to 1 for normalized numbers, infinites, and NaNs, and to 0 for zero and denormalized numbers.
The exponent is encoded in biased format. The biasing constant is 16'383 for the extended-real format.
NaN Encodings for ExtendedReal:
Class Sign Biased Significand
Exponent Integer Fraction
------------------------------------------------------------
Positive +Infinity 0 11..11 1 00..00
+Normals 0 11..10 1 11..11
. . . .
. . . .
0 00..01 1 00..00
+Denormals 0 00..00 0 11..11
. . . .
. . . .
0 00..00 0 00..01
+Zero 0 00..00 0 00..00
Negative -Zero 1 00..00 0 00..00
-Denormals 1 00..00 0 00..01
. . . .
. . . .
1 00..00 0 11..11
-Normals 1 00..01 1 00..01
. . . .
. . . .
1 11..10 1 11..11
-Infinity 1 11..11 1 00..00
NaNs SNaN X 11..11 1 0X..XX(2
QNaN X 11..11 1 1X..XX
Real Indefinite 1 11..11 1 10..00
(2 The fraction for SNaN encodings must be non zero.- Author:
- Werner Randelshofer, Hausmatt 10, CH-6405 Goldau, Switzerland.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ExtendedRealstatic final ExtendedRealstatic final ExtendedRealstatic final ExtendedRealstatic final ExtendedReal -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.lang.Number
byteValue, shortValue
-
Field Details
-
MAX_VALUE
-
MIN_VALUE
-
NaN
-
NEGATIVE_INFINITY
-
POSITIVE_INFINITY
-
-
Constructor Details
-
ExtendedReal
public ExtendedReal(byte[] bits) -
ExtendedReal
public ExtendedReal(double d)
-
-
Method Details
-
toByteArray
public byte[] toByteArray() -
isNaN
public boolean isNaN() -
isInfinite
public boolean isInfinite() -
doubleValue
public double doubleValue()- Specified by:
doubleValuein classNumber
-
floatValue
public float floatValue()- Specified by:
floatValuein classNumber
-
intValue
-
longValue
-
hashCode
-
equals
-
equals
-
toString
-