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

Raffaello Giulietti raffaello.giulietti at gmail.com
Mon Apr 19 16:18:11 UTC 2021


Hi Andrey,

thanks for your careful reading.

I'll keep a note and collect yours with changes coming from other 
reviewers before committing a larger batch of small changes. I would 
like to avoid wasting a lot of energy right now just to rebuild 
everything and to run the automatic tests on GitHub :-)


Greetings
Raffaello


On 2021-04-18 23:19, Andrey Turbanov wrote:
> 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