RFR: 8377427: Reduce substring allocations in Color.web(String, double) [v10]
Michael Strauß
mstrauss at openjdk.org
Fri Feb 20 23:20:44 UTC 2026
On Fri, 20 Feb 2026 22:54:01 GMT, Andy Goryachev <angorya at openjdk.org> wrote:
>> Interestingly, the test passes if we use Lemire's algorithm with the truncated significand instead of using the fallback. This might be a coincidence.
>
> so this is basically an invalid test, right?
>
>
> jshell> var a = 0.19999999999999998335;
> a ==> 0.19999999999999998
In contrast to a `long` literal, a `double` literal can have any number of digits. The value of the literal is then determined by the IEEE-754 round-to-nearest and ties-to-even rule (like in this algorithm). This is why the literal `0.19999999999999998335` has a value of 0.19999999999999998 (the nearest representable value). For comparison, the literal `0.19999999999999997` also has the value 0.19999999999999998.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/2069#discussion_r2835453839
More information about the openjfx-dev
mailing list