Re:In Erlang/OTP 27, +0.0 will no longer be exactly equal to...
by Y_Y on Tuesday May 09, 2023 @05:32PM
(#35880645)
Erlang too, now and in the future will say that minuszero==zero, it's a different more specific operator that's changing.
Re:In Erlang/OTP 27, +0.0 will no longer be exactly equal to...
by Kwpolska on Tuesday May 09, 2023 @06:01PM
(#35880943)
The `is` operator is checking object identity by comparing addresses. It is useless, although it may sometimes produce reasonable-looking results due to optimisations.
Python 3.11 gives me this:
>>> -0 is 0 <stdin>:1: SyntaxWarning: "is" with a literal. Did you mean "=="? True
Because (a) -0 is an integer, and there is only one integer zero, (b) small numbers have only one instance in memory as an optimization.
Playing with Python3:
>>> +0.0==-0.0 True
The C in GCC below also returns 1:
#include <stdio.h>
int main()
{