-
Notifications
You must be signed in to change notification settings - Fork 101
Closed
Description
Currently _3 o. _ (arctan(infinity)) gives 1.5708 and _3 o. __ gives _1.5708, however _3 o. 0j_ or _3 o. 0j__ would give NaN error (until J9.4).
Experimenting with other programming languages that has complex float and atan function such as Clozure Common Lisp or Chez Scheme gives these results and they are pretty much agree with each other if the imaginary part has infinity:
CL-USER> (ccl:set-fpu-mode :division-by-zero nil)
CL-USER> (atan #C(-432.0 1E++0))
#C(-1.5707964 0.0)
CL-USER> (atan #C(+432.0 1E++0))
#C(1.5707964 0.0)
CL-USER> (atan #C(+432.0 -1E++0))
#C(1.5707964 -0.0)
CL-USER> (atan #C(+432.0 +1E++0))
#C(1.5707964 0.0)
> (atan -432.0+inf.0i)
-1.5707963267948966+0.0i
> (atan 432.0+inf.0i)
1.5707963267948966+0.0i
But when the real part is infinity they are indifferent on what is NaN:
CL-USER> (ccl:set-fpu-mode :invalid nil)
6528 (13 bits, #x1980)
CL-USER> (atan #C(+1E++0 1.32))
#C(1.5707964 0.0)
CL-USER> (atan #C(+1E++0 -1.32))
#C(1.5707964 -0.0)
CL-USER> (atan #C(-1E++0 -1.32))
#C(-1.5707964 -0.0)
CL-USER> (atan #C(+1E++0 +1E++0))
#C(1.5707964 1E+-0 #| not-a-number |#)
CL-USER> (atan #C(+1E++0 -1E++0))
#C(1.5707964 1E+-0 #| not-a-number |#)
> (atan +inf.0-1.2i)
1.5707963267948966+nan.0i
> (atan +inf.0+1.2i)
1.5707963267948966+nan.0i
> (atan +inf.0+inf.0i)
1.5707963267948966+0.0i
> (atan +inf.0-inf.0i)
1.5707963267948966-0.0i
> (atan -inf.0-inf.0i)
-1.5707963267948966-0.0i
Metadata
Metadata
Assignees
Labels
No labels