RFR: 8378414: Add methods to test for representation equivalence

Raffaello Giulietti rgiulietti at openjdk.org
Mon Feb 23 17:12:09 UTC 2026


On Mon, 23 Feb 2026 17:05:29 GMT, Raffaello Giulietti <rgiulietti at openjdk.org> wrote:

>> Floating-point values have a notion of representation equivalence distinct from the comparison done by ==. This notion of equivalence could have a method to provide the predicate directly, rather than relying on one of several expressions listed in the documentation ([JDK-8295391](https://bugs.openjdk.org/browse/JDK-8295391)).
>
> test/jdk/java/lang/Math/Tests.java line 424:
> 
>> 422:                            float input1, int input2,
>> 423:                            float result, float expected) {
>> 424:         if (Float.equivalent(expected, result)) {
> 
> I think this is the cause of the tests failures I'm observing.
> Suggestion:
> 
>         if (!Float.equivalent(expected, result)) {

Definitely this mistake.
After correcting, the tests succeed.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29870#discussion_r2842026853


More information about the core-libs-dev mailing list