On Tue, 23 Apr 2024 17:40:21 GMT, Andy Goryachev <ango...@openjdk.org> wrote:

>> John Hendrikx has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   Fix mac test values
>
> tests/system/src/test/java/test/com/sun/javafx/text/TextLayoutTest.java line 
> 453:
> 
>> 451:             TextLayoutTest::assumeMac,
>> 452:             "The quick brown लोमड़ी jumps over the lazy कुत्ता",
>> 453:             160.0f, List.of(155.3047f, 91.04719f)
> 
> Question: these numbers are compared exactly (Float::compare), can we expect 
> them to be exactly the same on all possible platforms/versions?

Exact comparisons on float numbers should not be a problem, as long as you 
don't assume that with a different order of operations you will get the same 
result.  For example, `y + x - y` may not exactly equal `x + y - y` or `x`.  
Since we don't have different code paths for different platforms, and since all 
code paths are deterministic(*), it should be fine to do an exact comparison. 

If this ever does fail, I think then is a good time to do a more thorough 
investigation. So far these tests have run dozens of time on my machine, and on 
several of the machines of people reviewing without problems.

(*) In tests, the most often encountered source of non-determinism in Java is 
when a `Set` or `Map` is involved which contains objects with the default hash 
code which can change each time a new JVM is created; usually I change such 
collections to linked versions, or do an explicit sort somewhere to ensure it 
is deterministic again.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1236#discussion_r1576784350

Reply via email to