Summary
-------
Add a PRECISION public static final field to java.lang.Float and java.lang.Double
Problem
-------
The precision of float and double values, as defined by IEEE 754, is not easily derivable from the constants in the java.lang.Float resp. java.lang.Double classes. These values (24 resp. 53) are used in some places in the OpenJDK code base, where they appear as literals or even as derived literals, like 23 and 52. Hence, usages of these values are harder to find than necessary.
Solution
--------
It is proposed to add a PRECISION public static field to these classes. The values for MAX_EXPONENT and MIN_EXPONENT are then derived from static expressions at compile time, rather than being defined as literals.
Later enhancements could then replace the literals in the code base with the field names.
-------
Add a PRECISION public static final field to java.lang.Float and java.lang.Double
Problem
-------
The precision of float and double values, as defined by IEEE 754, is not easily derivable from the constants in the java.lang.Float resp. java.lang.Double classes. These values (24 resp. 53) are used in some places in the OpenJDK code base, where they appear as literals or even as derived literals, like 23 and 52. Hence, usages of these values are harder to find than necessary.
Solution
--------
It is proposed to add a PRECISION public static field to these classes. The values for MAX_EXPONENT and MIN_EXPONENT are then derived from static expressions at compile time, rather than being defined as literals.
Later enhancements could then replace the literals in the code base with the field names.
- csr for
-
JDK-8285241 Add a PRECISION public static field to j.l.Float and j.l.Double
-
- Closed
-
- relates to
-
JDK-8151776 Add constants related to floating-point fields to Float and Double
-
- Closed
-