val a: Double = Double.NaN
println(a == a) // false
val b: Number = a
println(a == b) // true
val c: Double = 0.0
println(c == -c) // true
val d: Number = c
println(d == -c) // false
(yes, I know why this has to happen for IEEE 754 and boxed equals() reasons, it's a fun puzzler to figure out if you don't know why though)
š 6
a
Alexey Belkov [JB]
09/12/2022, 10:35 AM
In Java plugin there is even a āJava | Numeric issues | Floating point equality comparisonā inspection, not for Kotlin though.