Can math.atan2 return INF?
Pierre-Alain Dorange
pdorange at pas-de-pub-merci.mac.com
Tue Jun 21 14:01:38 EDT 2016
Steven D'Aprano <steve at pearwood.info> wrote:
> Are there any circumstances where math.atan2(a, b) can return an infinity?
>
> I know it will return a NAN under some circumstances.
atan or atan2 can't return INFINITE, it was the arc tangent of a value,
then arc tangent can only be between -PI and +PI (is was an angle).
I do not know under what circumstance atan2 can return NAN, atan2 taks 2
argument (y and x) and return the angle corresponding to y/x.
If x is 0.0, atan2 return 0.0 (do not try to make the division).
atan2 was used over atan to optimize and so that it can used the correct
quadrant (for angle answer).
--
Pierre-Alain Dorange <http://microwar.sourceforge.net/>
Ce message est sous licence Creative Commons "by-nc-sa-2.0"
<http://creativecommons.org/licenses/by-nc-sa/2.0/fr/>
More information about the Python-list
mailing list