Prior to this change, the compiler was crashing if you tried to compare the identity equality of two floating-point values of the same type. Now, the case is handled.
Values are compared by comparing their integer bits, so that there are no edge cases around things like NaN or various infinite values, failing to compare as they would with value equality. Identity equality is about not being able to distinguish the two operands, and any different floating-point encoded values are distinguishable by calling their bits method, which can reveal different results even when the bits encode a conceptually equivalent value (different bit encodings of the same real number). Similarly, NaN values even if they do not compare with == should have identity equality if they have exactly the same bits.
Prior to this change, the compiler was crashing if you tried to compare the identity equality of two floating-point values of the same type. Now, the case is handled.
Values are compared by comparing their integer bits, so that there are no edge cases around things like
NaN
or various infinite values, failing to compare as they would with value equality. Identity equality is about not being able to distinguish the two operands, and any different floating-point encoded values are distinguishable by calling theirbits
method, which can reveal different results even when the bits encode a conceptually equivalent value (different bit encodings of the same real number). Similarly, NaN values even if they do not compare with==
should have identity equality if they have exactly the same bits.