Sun 07 May 2017 06:12:20 AM UTC, comment #11:
Yes.
Although these results are still significantly different from MATLAB.
>> atan2 (0, 0)
ans = 3.1416
>> angle(00i)
ans = 3.1416
>>

Thu 04 May 2017 07:17:01 PM UTC, comment #10:
Yeah, so Matlab doesn't throw away the signed zero, it just doesn't display it. And then it uses it inconsistenly.
I think it's a bug in Octave that the constant 00i is narrowed to a real value. That seems bad to me, but most people don't seem to care about that.

Thu 04 May 2017 06:50:54 PM UTC, comment #9:

Thu 04 May 2017 06:49:33 PM UTC, comment #8:
>> x = 1/Inf
x =
0

Thu 04 May 2017 06:48:47 PM UTC, comment #7:
I just found this web page that discusses signed zeros in MATLAB. It's not very encouraging.
https://www.advanpix.com/2016/04/28/branchcutsandsignedzerosinmatlab/
So this is probably more a WTF!? MATLAB issue than a bug.

Thu 04 May 2017 06:48:18 PM UTC, comment #6:
Finally, what does Matlab do for the following:

Thu 04 May 2017 05:54:00 PM UTC, comment #5:
Response using myatan2 mex:
MATLAB

Thu 04 May 2017 05:50:31 PM UTC, comment #4:
Response using myfunc mex:
MATLAB

Thu 04 May 2017 04:20:27 PM UTC, comment #3:
Also, with the attached MEX file myatan2.c, please try the following with Matlab and report back what it displays:
(file #40581)

Thu 04 May 2017 04:15:41 PM UTC, comment #2:
I think this is more of an issue about automatic narrowing and whether Matlab keeps the sign bit on an IEEE 0.
Because storing complex numbers requires double the amount of storage (real and imaginary 8byte numbers), Octave automatically tries to compact to a real array whenever the complex part is equal to zero. Try the failing code in two steps:
In the first stage, Octave compacts the value to '0'. And the angle of 0 is pi. Does Matlab keep the signbit for zero values? What does the following return in Matlab?
In Octave

Thu 04 May 2017 04:13:14 PM UTC, comment #1:
Could someone please take the attached MEX file, myfunc.c, and try it with Matlab and report back what it displays for the following:
(file #40580)

Thu 04 May 2017 02:05:29 PM UTC, original submission:
Octave 4.2.1
MATLAB
