I am working with version 13.3 on a Mac. The command c = Unitize[arg] gives a list of zeros every time I try it.
c = Unitize[arg]
Martijn, I doubt there is anything I can change about this, but I’ll take a look because it does seem suspicious. Your explanation in this recent response, and isolation of clear examples, is a big help.
Thanks Daniel! For now i know the reason why my code changed outputs and i have a fix for it which works in all versions and i learned some things on the way so I'm happy for now.
Can you check mine too? I recently downloaded 13.3 on my Debian linux and checked there is the same issue as in cloud.
The C99 complex.h requires a separate implementation, that is in glibc and Intel libm, even less accurate than real numbers math.h glibc and Microsoft math library. Mathematica did not bother, it just uses naive implementation for complex multiplication. In practice the code using glibc is less accurate than from Windows:
https://community.wolfram.com/groups/-/m/t/2851685
The idea behind having 0*0.0 evaluate to 0.0 is to maintain the type rule int times real equal real. One can question this of course. But it has advantages particularly for type consistency and inferencing, as is needed in Compile and the newer FunctionCompile world.
From the documentation on Numbers:
Whenever you give a number with an explicit decimal point, the Wolfram Language produces an approximate numerical result
Here is what happens by multiplying an approximate number by the exact zero:
In[2]:= 0*0. Out[2]= 0.