[K/N] Use toBits() in Float and Double hashCode()
toBits() is aware of NaNs comparing to bits()
This commit is contained in:
@@ -1603,9 +1603,7 @@ public final class Float private constructor() : Number(), Comparable<Float> {
|
|||||||
|
|
||||||
public override fun toString() = NumberConverter.convert(this)
|
public override fun toString() = NumberConverter.convert(this)
|
||||||
|
|
||||||
public override fun hashCode(): Int {
|
public override fun hashCode(): Int = toBits()
|
||||||
return bits()
|
|
||||||
}
|
|
||||||
|
|
||||||
@TypedIntrinsic(IntrinsicType.REINTERPRET)
|
@TypedIntrinsic(IntrinsicType.REINTERPRET)
|
||||||
@PublishedApi
|
@PublishedApi
|
||||||
@@ -1915,7 +1913,7 @@ public final class Double private constructor() : Number(), Comparable<Double> {
|
|||||||
|
|
||||||
public override fun toString(): String = NumberConverter.convert(this)
|
public override fun toString(): String = NumberConverter.convert(this)
|
||||||
|
|
||||||
public override fun hashCode(): Int = bits().hashCode()
|
public override fun hashCode(): Int = toBits().hashCode()
|
||||||
|
|
||||||
@TypedIntrinsic(IntrinsicType.REINTERPRET)
|
@TypedIntrinsic(IntrinsicType.REINTERPRET)
|
||||||
@PublishedApi
|
@PublishedApi
|
||||||
|
|||||||
Reference in New Issue
Block a user