On Fri, 13 Feb 2026 21:00:02 GMT, Andy Goryachev <[email protected]> wrote:
>> Double parsing can be lossy if you think of the input as an _exact_ number. >> Some algorithms parse an exact number into the nearest representable double >> by (conceptually) first converting the number with infinite precision, and >> then rounding to the nearest double. `Double.parseDouble()` does that, while >> the simpler algorithm in this PR doesn't. It's not like one algorithm is >> exact and the other isn't, it's more like this algorithm sometimes won't >> give you the nearest representable double, but be off by an ulp. >> `Double.parseDouble()` will always give you the nearest representable double. > > perhaps a short version of this explanation should be added to the javadoc, > to explain the behavior (especially since it differs from > `Double.parseDouble()`. I've thought about that some more, and decided to use a fast algorithm that _does_ guarantee correct rounding for 64-bit significands. This means that the results are now identical to `Double.parseDouble()`, because the latter also guarantees correct rounding. ------------- PR Review Comment: https://git.openjdk.org/jfx/pull/2069#discussion_r2807428576
