JDK 9 RFR of JDK-8149896: Remove unnecessary values in FloatConsts and DoubleConsts

Paul Sandoz paul.sandoz at oracle.com
Tue Feb 16 09:05:04 UTC 2016


> On 16 Feb 2016, at 07:23, joe darcy <joe.darcy at oracle.com> wrote:
> 
> Hello,
> 
> The the FloatConsts and DoubleConsts classes, while moved to an internal package recently (JDK-8145990), contain constants now available via the public API. All such uses of the redundant values should be removed as well as the redundant constants themselves.
> 
> A quick note on the 2d changes, several constants (and a copy from a package-private method from java.lang) were used to initialize a double value POWER_2_TO_32; this can be accomplished more directly using a hexadecimal floating-point literal.
> 
> Please review the webrev
> 
>    http://cr.openjdk.java.net/~darcy/8149896.0/
> 

+1

My favourite change is this one:

-    private static final double POWER_2_TO_32 = FloatMath.powerOfTwoD(32);
+    private static final double POWER_2_TO_32 = 0x1.0p32;

and the removal of the method on FloatMath.

Paul.



More information about the core-libs-dev mailing list