RFR: 8377427: Reduce substring allocations in Color.web(String, double) [v4]
Michael Strauß
mstrauss at openjdk.org
Sat Feb 14 12:28:48 UTC 2026
On Sat, 14 Feb 2026 00:29:35 GMT, John Hendrikx <jhendrikx at openjdk.org> wrote:
>> Michael Strauß has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Review comments
>
> 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).
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/2069#discussion_r2807442528
More information about the openjfx-dev
mailing list