std.math.atan2 -- range of output

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Sun Dec 1 02:21:07 PST 2013


On 30/11/13 18:44, Joseph Rushton Wakeling wrote:
> I ask because I ran into this while trying to create a unittest for the case
>
>      (-1.0) ^^ complex(1.0, 1.0);
>
> ... as part of the work I'm doing on
> https://d.puremagic.com/issues/show_bug.cgi?id=11652

.... although deeper investigation shows that this case the fault is not with 
atan2: the problem is that this number evaluates to

     -0.0432139 - 2.34263e-21i

i.e. the imaginary part evaluates to something very slightly imaginary, which in 
turn leads to an argument that is _almost_ -PI.

Still, I'm curious about the rationale behind the behaviour of atan2.


More information about the Digitalmars-d-learn mailing list