a = round(0.1)
0.0
b = round(-0.1)
-0.0
a == b
true
a === b
false
bits(a)
"0000000000000000000000000000000000000000000000000000000000000000"
bits(b)
"1000000000000000000000000000000000000000000000000000000000000000"
dict = [i => exp(i) for i in [a,b]]
Dict{Any,Any} with 1 entry:
0.0 => 1.0
but got this:
dict = [i => exp(i) for i in [a,b]]
Dict{Any,Any} with 2 entries:
0.0 => 1.0
-0.0 => 1.0
It is not a big problem really but I would like to know where can this behaviour come handy.
Cheers!
round(Int, x)
Which returns the result as an integer. Integers do not have this situation (difference between +0.0 and -0.0)
IEEE has not made the programming language designer's life easy here.