RFR: 8377427: Reduce substring allocations in Color.web(String, double) [v4]
John Hendrikx
jhendrikx at openjdk.org
Sat Feb 14 14:04:12 UTC 2026
On Sat, 14 Feb 2026 12:26:29 GMT, Michael Strauß <mstrauss at openjdk.org> wrote:
>> modules/javafx.graphics/src/main/java/com/sun/javafx/css/parser/CssNumberParser.java line 33:
>>
>>> 31:
>>> 32: // Up to 19 decimal digits fit in a signed 64-bit long
>>> 33: private static final int MAX_SIG_DIGITS = 19;
>>
>> Not sure if this should matter, but even though that's true for a `long`, a `double` holds about 4-5 less significant digits, so you could stop earlier I suppose.
>
> This needs to be viewed in the context of IEEE754 correct rounding, which assumes infinite precision at conversion, and then chooses the nearest representable double. While we currently do correct rounding for up to 64-bit significands, correctly rounding larger significands would probably require us to actually go to infinite precision (BigDecimal).
Okay, if the extra digits have value then no problem. And I agree we don't need to go through even more hoops to support more digits :)
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/2069#discussion_r2807518643
More information about the openjfx-dev
mailing list