RFR: 4511638: Double.toString(double) sometimes produces incorrect results [v14]

Raffaello Giulietti duke at openjdk.java.net
Wed Jun 1 10:32:34 UTC 2022


On Tue, 31 May 2022 22:11:54 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> Raffaello Giulietti has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   4511638: Double.toString(double) sometimes produces incorrect results
>
> src/java.base/share/classes/jdk/internal/math/FloatToDecimal.java line 97:
> 
>> 95:     private static final int MASK_28 = (1 << 28) - 1;
>> 96: 
>> 97:     private static final int NON_SPECIAL    = 0;
> 
> As these are shared with `DoubleToDecimal` would these constants be better moved to a common location, e.g., `MathUtils` whether converted to an `enum` or not?

As long as the values are constant `ints`, moving them to `MathUtils` is less robust. Changing any value would require remembering to recompile the "clients".
The move would make sense if these were an enum.

-------------

PR: https://git.openjdk.java.net/jdk/pull/3402


More information about the core-libs-dev mailing list