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

Steven D'Aprano <steve at pearwood.info> writes: > On Thu, 23 Jun 2016 05:17 am, Ben Bacarisse wrote: > >> 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. > > Given: > > x = INF > y = INF > assert x == y > > there is a reason to pick atan2(y, x) = pi/4: > > Since x == y, the answer should be the same as for any other pair of x == y. > > It might not be a *great* reason, but it's a reason. ...provided you consider atan2(0, 0) == 0 to be a bug! -- Ben.

- Prev by Date:
**Operator Precedence/Boolean Logic** - Next by Date:
**Can math.atan2 return INF?** - Previous by thread:
**Can math.atan2 return INF?** - Next by thread:
**Can math.atan2 return INF?** - Index(es):