Can math.atan2 return INF?

Pierre-Alain Dorange pdorange at pas-de-pub-merci.mac.com
Wed Jun 22 13:18:02 EDT 2016


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°.

x only infinite would be  0° (0 radians)
y only infinite woudl be 180° (pi/2 radians)

-- 
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