On Mon, 23 Feb 2026 17:56:26 GMT, Joe Darcy <[email protected]> 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)).
>
> Joe Darcy has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Respond to review feedback; add build tags.

src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float16.java line 
1075:

> 1073:      */
> 1074:     public static boolean equivalent(Float16 f1, Float16 f2) {
> 1075:         return Float.equivalent(f1.floatValue(), f2.floatValue());

Maybe use `Float16.float16ToShortBits(…)` instead, matching 
`Float16​::equals(…)`, which avoids the `Float16` to `float` conversion:
https://github.com/openjdk/jdk/blob/49f14eb9fca155319d5475019715189e9f65dffd/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float16.java#L936-L939

Suggestion:

        return float16ToShortBits(f1) == float16ToShortBits(f2);

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

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

Reply via email to