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

Andrey Turbanov github.com+741251+turbanoff at openjdk.java.net
Sun Apr 18 21:19:43 UTC 2021


On Fri, 16 Apr 2021 11:30:32 GMT, Raffaello Giulietti <github.com+70726043+rgiulietti at openjdk.org> wrote:

>> Hello,
>> 
>> here's a PR for a patch submitted on March 2020 [1](https://cr.openjdk.java.net/~bpb/4511638/webrev.04/) when Mercurial was a thing.
>> 
>> The patch has been edited to adhere to OpenJDK code conventions about multi-line (block) comments. Nothing in the code proper has changed, except for the addition of redundant but clarifying parentheses in some expressions.
>> 
>> 
>> Greetings
>> Raffaello
>
> 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/DoubleToDecimal.java line 69:

> 67: 
> 68:     /* 10^(E_MIN - 1) <= MIN_VALUE < 10^E_MIN */
> 69:     static final int E_MIN = -323;

It seems that `E_MIN`/`E_MAX`/`K_MIN`/`K_MAX`  are not used in production code. 
I think it worth to move them to tests.

src/java.base/share/classes/jdk/internal/math/DoubleToDecimal.java line 117:

> 115:      * where there are H digits d
> 116:      */
> 117:     public final int MAX_CHARS = H + 7;

Can it be made `static` ?

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

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


More information about the core-libs-dev mailing list