In Erlang/OTP 27, +0.0 will no longer be exactly equal to -0.0
erlangforums.com
In Erlang/OTP 27, +0.0 will no longer be exactly equal to -0.0
1–10 of 236 posts
Re: In Erlang/OTP 27, +0.0 will no longer be exactly equal to -0.0
#2Re: In Erlang/OTP 27, +0.0 will no longer be exactly equal to -0.0
#3I'm wondering what they are going to do with other operators, >=, <= etc
Re: In Erlang/OTP 27, +0.0 will no longer be exactly equal to -0.0
#4Re: In Erlang/OTP 27, +0.0 will no longer be exactly equal to -0.0
#5Re: In Erlang/OTP 27, +0.0 will no longer be exactly equal to -0.0
#6This feels like a bad idea. Treating +0 and -0 as unequal because they have different bit patterns is no more correct than treating two NaNs as equal because they have the same bit pattern. Zero is zero.
But yeah, you’re right
Re: In Erlang/OTP 27, +0.0 will no longer be exactly equal to -0.0
#7> The == operator will continue to return true for 0.0 == -0.0.
Re: In Erlang/OTP 27, +0.0 will no longer be exactly equal to -0.0
#8As a general rule, if you find yourself comparing floating point numbers, that's probably not what you want. I'm wondering what they are going to do with other operators, >=, <= etc
Re: In Erlang/OTP 27, +0.0 will no longer be exactly equal to -0.0
#9This feels like a bad idea. Treating +0 and -0 as unequal because they have different bit patterns is no more correct than treating two NaNs as equal because they have the same bit pattern. Zero is zero.
Stand in place and turn around: how far did you go from where you started?
Nonetheless, I agree. It's a bad idea.
Re: In Erlang/OTP 27, +0.0 will no longer be exactly equal to -0.0
#10Can anyone fill me in what the meaning of == vs =:= in Erlang is? Since after the change +0. == -0. but not +0. =:= -0.
1> 1==1.0.
true
2> 1=:=1.0.
false
You can think of it as analogous to == vs === in JS, except that the "type safety" here really only refers to different numeric types (and in JS there is no such distinction)[1]: https://www.erlang.org/doc/reference_manual/expressions.html...