public class ExtendedReal
extends java.lang.Number
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.Modifier and Type | Field and Description |
---|---|
static ExtendedReal |
MAX_VALUE |
static ExtendedReal |
MIN_VALUE |
static ExtendedReal |
NaN |
static ExtendedReal |
NEGATIVE_INFINITY |
static ExtendedReal |
POSITIVE_INFINITY |
Constructor and Description |
---|
ExtendedReal(byte[] bits) |
ExtendedReal(double d) |
Modifier and Type | Method and Description |
---|---|
double |
doubleValue() |
boolean |
equals(ExtendedReal obj) |
boolean |
equals(java.lang.Object obj) |
float |
floatValue() |
int |
hashCode() |
int |
intValue() |
boolean |
isInfinite() |
boolean |
isNaN() |
long |
longValue() |
java.lang.String |
toString()
FIXME: Loss of precision, because we currently convert to double before
we create the String.
|
public static final ExtendedReal MAX_VALUE
public static final ExtendedReal MIN_VALUE
public static final ExtendedReal NaN
public static final ExtendedReal NEGATIVE_INFINITY
public static final ExtendedReal POSITIVE_INFINITY
public ExtendedReal(byte[] bits)
public ExtendedReal(double d)
public boolean isNaN()
public boolean isInfinite()
public double doubleValue()
doubleValue
in class java.lang.Number
public float floatValue()
floatValue
in class java.lang.Number
public int intValue()
intValue
in class java.lang.Number
public long longValue()
longValue
in class java.lang.Number
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public boolean equals(ExtendedReal obj)
public java.lang.String toString()
toString
in class java.lang.Object