[lworld] RFR: 8298659: [lworld] ValueObject isSubstutitable comparison of float/double should use raw bits [v2]
Jens Lidestrom
duke at openjdk.org
Fri Feb 9 17:08:10 UTC 2024
On Fri, 9 Feb 2024 16:48:35 GMT, Roger Riggs <rriggs at openjdk.org> wrote:
>> Update the substitutability implementation to match the new JLS for JEP 401.
>> Float and double values should be compared for equality using the raw bits.
>
> Roger Riggs has updated the pull request incrementally with one additional commit since the last revision:
>
> Revert change to ObjectMethods to avoid changing behavior of equals for floats in records.
> Create a separate cache of method pointers for substitutablity test for primitives in ValueObjectMethods.
src/java.base/share/classes/java/lang/runtime/ValueObjectMethods.java line 697:
> 695: * this method returns {@code a == b} with the following exception:
> 696: * <ul>
> 697: * <li> For primitive types {@code float} and {@code double} the
I'm not sure if this is public documentation for users or internal documentation for implementers.
If this is for users then it might be helpful with a description of what the new equality semantics actually implies for NaNs and the various zeros and infinities.
Having to look up `toRawBits` and figure it out will be hard for most people.
-------------
PR Review Comment: https://git.openjdk.org/valhalla/pull/998#discussion_r1484587637
More information about the valhalla-dev
mailing list