On Wed, 2 Sep 2026 02:46:29 GMT, Stuart Marks <[email protected]> wrote:

>> Naoto Sato has updated the pull request incrementally with two additional 
>> commits since the last revision:
>> 
>>  - Merge remote-tracking branch 'jdk-sandbox/json' into 
>> JDK-8381976-Implementation-for-Simple-JSON-API
>>  - Use SequencedMap type for the member field
>
> src/jdk.incubator.json/share/classes/jdk/incubator/json/impl/JsonNumberImpl.java
>  line 125:
> 
>> 123:                 // Remove trailing zeros from the significand and 
>> compensate in the power.
>> 124:                 // We do this to avoid possible overflow when we parse 
>> the coefficient as a long.
>> 125:                 // E.g. 9223372036854775807.000000 or 
>> 922337203685477580700.0e-2
> 
> I'm not sure what "coefficient" is in this context. Is it the significand, or 
> rather, the significand with trailing zeroes stripped? Also, I think overflow 
> cannot be avoided in general, but doing the zero-stripping will reduce the 
> possibility of this. Of course there is the possibility that the exponent 
> (power) could overflow because of this, but this seems less likely.

The old wording used coefficient, but really should have just said significand 
again. It refers to the sig with stripped zeros such that overflow does not 
occur for that case.

You are right that we can't avoid it in general, I cleaned up the wording to 
make it clear that this particular case/code was for when the value is 
representable as a `long` but trailing zeros would cause overflow when parsing 
the sig. E.g. `9223372036854775807.000000`

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

PR Review Comment: https://git.openjdk.org/jdk/pull/32282#discussion_r3917614022

Reply via email to