> "C. G. Montgomery" < XXXX@XXXXX.COM > writes:
>> Other computer languages which provide this function commonly
specify the
>> "principal angle", the one between -pi and pi.
>>
>> Proposal
>>
>> The first sentence of the definition should be expanded to:
>> r3 is the radian angle, greater than -pi and less than or equal to pi,
>> whose tangent is r1/r2.
>
> The C standard specifies "[-pi,pi]", i.e., greater than or equal to
> -pi.
Right. There's a discrepancy in that respect with OpenMath. I vote
for the C spec, because it's natural when you have -0e, as in the
test
\ y x
t{ -0e -1e fatan2 -> -pi }t
for which (x, y) = (-1e,-0e) expresses the limit from below on
the negative real axis.
> And on Gforth (which uses C's atan2):
> -1e 0e fatan2 f.
>
> outputs
>
> -1.5707963267949
>
> and I guess that Gforth is not the only one.
True, but I wonder if you didn't mean:
-0e -1e fatan2 f. -3.14159265358979 ok
> So I suggest including -pi in the range.
Me, too. I believe the replacement language "greater than or
equal to -pi and less than or equal to pi" in Charles' proposal
would not mean that a compliant system actually has to have -0e,
with FATAN2 actually defined at the limit from below on the
negative real axis.
On the other hand, I would certainly hope that systems that do
have IEEE 754, which is optional in ANS Forth, would have -0e
and would give the -pi result above.
-- David