[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Can math.atan2 return INF?

pdorange at pas-de-pub-merci.mac.com (Pierre-Alain Dorange) writes:

> Ben Bacarisse <ben.usenet at bsb.me.uk> wrote:
>>   >>> math.atan2(INF, INF)
>>   0.7853981633974483
>> I would have expected NaN since atan2(INF, INF) could be thought of as
>> the limit of atan2(x, y) which could be any value in the range.  And I'd
>> have guessed atan2(0, 0) would have been NaN too but
> i'm not a math expert, but the limit of atan2 would be 45?, so pi/4
> radians (0,7854).
> As x,y are coordinates, the both infinite would tend toward 45?.

The limit of atan2(x, x) is as you describe, but there is no reason to
pick that one case.  lim{x->oo,y->oo}atan2(x, y) is undefined unless a
relationship is given between x and y and you get get any result you
like in the range of atan2 by choosing one or other relationship.