Can math.atan2 return INF?

Nagy László Zsolt gandalf at shopzeus.com
Mon Jun 27 09:27:51 EDT 2016


> Thanks, I'm in the same position as you, except that I'm in the position
> where I need it use the result, and if it ever returns INF my function will
> blow up. But it doesn't look like that can happen.
>
Doesn't atan2 relies on the C lib math floating point library? At least
in CPython. I think (but not 100% sure) that it is implementation
dependent, and returns what is returned by clib floating point lib.
Since the meaning of atan2 is an angle, it should always be between
[-pi,pi]. The only exception maybe when there is a NaN in the arguments.
But I cannot think of any interpretation where atan2 would return Inf or
-Inf.


More information about the Python-list mailing list