JDK-8151776 : Add constants related to floating-point fields to Float and Double
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 9
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • Submitted: 2016-03-13
  • Updated: 2022-05-31
  • Resolved: 2022-05-31
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Description
When dealing with floating-point numbers, at times it is helpful and necessary to manipulate the sign, significand, and exponent fields.This is eased by having bit masks and other related constants to isolate the fields.

Such constants are available in the JDK-internal FloatConsts and DoubleConsts classes, but are not part of the public API. Code review of JDK-8149896 included a request to add such a public API (http://mail.openjdk.java.net/pipermail/core-libs-dev/2016-February/038886.html).
Comments
Public `[Double|Float].PRECISION` fields have been added recently. Other fields in `FloatConsts` and `DoubleConsts` can be statically derived from the public fields in Double and Float and probably have only limited use outside the JDK itself. Thus, they will not be made public for now.
30-05-2022

Public `[Double|Float].PRECISION` fields have been added recently. Other fields in `FloatConsts` and `DoubleConsts` can be statically derived from the public fields in Double and Float and probably have only limited use outside the JDK itself.
25-05-2022

With the addition of the PRECISION constants to Float and Double, it appears that the jdk.internal.math.{Double,Float}Consts.SIGNIFICAND_WIDTH constants can be removed and the usages thereof replaced globally with {Double,Float}.PRECISION, respectively.
11-05-2022