Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #110260

Re: Can math.atan2 return INF?

From Jussi Piitulainen <jussi.piitulainen@helsinki.fi>
Newsgroups comp.lang.python
Subject Re: Can math.atan2 return INF?
Date 2016-06-21 21:32 +0300
Organization A noiseless patient Spider
Message-ID <lf57fdigzov.fsf@ling.helsinki.fi> (permalink)
References <57697e61$0$1590$c3e8da3$5496439d@news.astraweb.com> <1mp7m3g.picev12e77h4N%pdorange@pas-de-pub-merci.mac.com>

Show all headers | View raw


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

> Steven D'Aprano <steve@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).

It seems to return NaN when either argument is NaN. It seems to return
finite values when either argument is Inf or -Inf, and negative zeroes
lead to different but finite answers.

Wikipedia says ata2(0,0) is considered undefined traditionally and in
symbolic maths but otherwise most computer implementations define it.
Python seems to produce +-0.0 and +-pi for variously signed zeroes.

I didn't see any mention of it ever being infinite, which makes sense
given that arcus functions are supposed to return angles. The extreme
case seemed to be the inclusion of -pi as a possible value.

(I know nothing, I was just curious enough to play with this a bit.)

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Can math.atan2 return INF? Steven D'Aprano <steve@pearwood.info> - 2016-06-22 03:50 +1000
  Re: Can math.atan2 return INF? pdorange@pas-de-pub-merci.mac.com (Pierre-Alain Dorange) - 2016-06-21 20:01 +0200
    Re: Can math.atan2 return INF? Jussi Piitulainen <jussi.piitulainen@helsinki.fi> - 2016-06-21 21:32 +0300
      Re: Can math.atan2 return INF? Steven D'Aprano <steve@pearwood.info> - 2016-06-22 11:40 +1000
        Re: Can math.atan2 return INF? Nagy László Zsolt <gandalf@shopzeus.com> - 2016-06-27 15:27 +0200
    Re: Can math.atan2 return INF? Steven D'Aprano <steve@pearwood.info> - 2016-06-22 11:38 +1000
      Re: Can math.atan2 return INF? pdorange@pas-de-pub-merci.mac.com (Pierre-Alain Dorange) - 2016-06-22 08:21 +0200
      Re: Can math.atan2 return INF? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-06-22 16:34 +0100
        Re: Can math.atan2 return INF? Random832 <random832@fastmail.com> - 2016-06-22 12:19 -0400
        Re: Can math.atan2 return INF? pdorange@pas-de-pub-merci.mac.com (Pierre-Alain Dorange) - 2016-06-22 19:18 +0200
          Re: Can math.atan2 return INF? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-06-22 20:17 +0100
            Re: Can math.atan2 return INF? Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-06-22 12:50 -0700
            Re: Can math.atan2 return INF? Steven D'Aprano <steve@pearwood.info> - 2016-06-23 13:59 +1000
              Re: Can math.atan2 return INF? Dan Sommers <dan@tombstonezero.net> - 2016-06-23 04:40 +0000
                Re: Can math.atan2 return INF? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2016-06-23 16:45 +1000
                Re: Can math.atan2 return INF? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-06-23 15:39 +0100
                Re: Can math.atan2 return INF? alister <alister.ware@ntlworld.com> - 2016-06-23 15:04 +0000
                Re: Can math.atan2 return INF? Steven D'Aprano <steve@pearwood.info> - 2016-06-24 02:44 +1000
                Re: Can math.atan2 return INF? pdorange@pas-de-pub-merci.mac.com (Pierre-Alain Dorange) - 2016-06-23 19:14 +0200
                Re: Can math.atan2 return INF? Marko Rauhamaa <marko@pacujo.net> - 2016-06-23 20:22 +0300
                Re: Can math.atan2 return INF? pdorange@pas-de-pub-merci.mac.com (Pierre-Alain Dorange) - 2016-06-24 09:53 +0200
                Re: Can math.atan2 return INF? Marko Rauhamaa <marko@pacujo.net> - 2016-06-24 13:38 +0300
                Re: Can math.atan2 return INF? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2016-06-26 11:43 +1200
                Re: Can math.atan2 return INF? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2016-06-26 11:40 +1200
                Re: Can math.atan2 return INF? Marko Rauhamaa <marko@pacujo.net> - 2016-06-26 10:09 +0300
                Re: Can math.atan2 return INF? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2016-06-27 11:08 +1200
                Re: Can math.atan2 return INF? Steven D'Aprano <steve@pearwood.info> - 2016-06-27 12:59 +1000
                Re: Can math.atan2 return INF? Marko Rauhamaa <marko@pacujo.net> - 2016-06-27 09:40 +0300
                Re: Can math.atan2 return INF? Rustom Mody <rustompmody@gmail.com> - 2016-06-27 06:15 -0700
                Re: Can math.atan2 return INF? Marko Rauhamaa <marko@pacujo.net> - 2016-06-27 16:45 +0300
                Re: Can math.atan2 return INF? Rustom Mody <rustompmody@gmail.com> - 2016-06-27 07:01 -0700
                Re: Can math.atan2 return INF? Marko Rauhamaa <marko@pacujo.net> - 2016-06-27 17:12 +0300
                Re: Can math.atan2 return INF? Rustom Mody <rustompmody@gmail.com> - 2016-06-27 07:27 -0700
                Re: Can math.atan2 return INF? Marko Rauhamaa <marko@pacujo.net> - 2016-06-27 20:03 +0300
                Re: Can math.atan2 return INF? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2016-06-28 18:12 +1200
                Re: Can math.atan2 return INF? Rustom Mody <rustompmody@gmail.com> - 2016-06-27 23:25 -0700
                Re: Can math.atan2 return INF? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2016-06-28 16:27 +1000
                Re: Can math.atan2 return INF? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2016-06-28 18:12 +1200
                Re: Can math.atan2 return INF? Marko Rauhamaa <marko@pacujo.net> - 2016-06-28 09:23 +0300
                Re: Can math.atan2 return INF? Random832 <random832@fastmail.com> - 2016-06-28 09:39 -0400
                Re: Can math.atan2 return INF? Steven D'Aprano <steve@pearwood.info> - 2016-06-29 01:22 +1000
                Re: Can math.atan2 return INF? Marko Rauhamaa <marko@pacujo.net> - 2016-06-28 19:36 +0300
                Re: Can math.atan2 return INF? Marko Rauhamaa <marko@pacujo.net> - 2016-06-28 19:42 +0300
                Re: Can math.atan2 return INF? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2016-06-29 19:35 +1000
                Re: Can math.atan2 return INF? Marko Rauhamaa <marko@pacujo.net> - 2016-06-29 13:54 +0300
                Re: Can math.atan2 return INF? Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-06-29 18:33 -0700
                Re: Can math.atan2 return INF? Rustom Mody <rustompmody@gmail.com> - 2016-06-29 19:13 -0700
                Re: Can math.atan2 return INF? Chris Angelico <rosuav@gmail.com> - 2016-06-30 12:38 +1000
                Re: Can math.atan2 return INF? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2016-06-30 18:24 +1000
                Re: Can math.atan2 return INF? Andreas Röhler <andreas.roehler@online.de> - 2016-06-30 11:35 +0200
                Re: Can math.atan2 return INF? Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-06-30 02:42 -0700
                Re: Can math.atan2 return INF? Andreas Röhler <andreas.roehler@online.de> - 2016-06-30 12:13 +0200
                Re: Can math.atan2 return INF? Andreas Röhler <andreas.roehler@online.de> - 2016-06-30 12:11 +0200
                Re: Can math.atan2 return INF? Steven D'Aprano <steve@pearwood.info> - 2016-07-01 03:18 +1000
                Re: Can math.atan2 return INF? Rustom Mody <rustompmody@gmail.com> - 2016-06-30 08:28 -0700
                Re: Can math.atan2 return INF? Steven D'Aprano <steve@pearwood.info> - 2016-07-01 04:03 +1000
                Re: Can math.atan2 return INF? Rustom Mody <rustompmody@gmail.com> - 2016-07-01 07:19 -0700
                Re: Can math.atan2 return INF? Marko Rauhamaa <marko@pacujo.net> - 2016-07-01 18:20 +0300
                Re: Can math.atan2 return INF? Rustom Mody <rustompmody@gmail.com> - 2016-07-29 22:46 -0700
                Re: Can math.atan2 return INF? Steven D'Aprano <steve@pearwood.info> - 2016-08-01 12:53 +1000
                Re: Can math.atan2 return INF? Paul Rubin <no.email@nospam.invalid> - 2016-07-31 20:41 -0700
                Re: Can math.atan2 return INF? Rustom Mody <rustompmody@gmail.com> - 2016-07-31 20:54 -0700
                Re: Can math.atan2 return INF? Rustom Mody <rustompmody@gmail.com> - 2016-07-31 21:05 -0700
                Re: Can math.atan2 return INF? Ian Kelly <ian.g.kelly@gmail.com> - 2016-08-01 01:05 -0600
                Re: Can math.atan2 return INF? Rustom Mody <rustompmody@gmail.com> - 2016-07-24 19:48 -0700
                Re: Can math.atan2 return INF? Marko Rauhamaa <marko@pacujo.net> - 2016-06-30 09:24 +0300
                Re: Can math.atan2 return INF? Rustom Mody <rustompmody@gmail.com> - 2016-06-29 23:29 -0700
                Re: Can math.atan2 return INF? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2016-06-30 07:47 -0400
                Re: Can math.atan2 return INF? alister <alister.ware@ntlworld.com> - 2016-06-30 14:54 +0000
                Re: Can math.atan2 return INF? Paul Rubin <no.email@nospam.invalid> - 2016-06-29 23:57 -0700
                Re: Can math.atan2 return INF? Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-06-30 00:16 -0700
                Re: Can math.atan2 return INF? Paul Rubin <no.email@nospam.invalid> - 2016-06-30 00:32 -0700
                Re: Can math.atan2 return INF? Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-06-30 00:39 -0700
                Re: Can math.atan2 return INF? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2016-06-30 18:27 +1000
                Re: Can math.atan2 return INF? Andreas Röhler <andreas.roehler@online.de> - 2016-06-30 09:17 +0200
                Re: Can math.atan2 return INF? Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-06-30 00:17 -0700
                Re: Can math.atan2 return INF? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2016-06-30 18:06 +1200
                Re: Can math.atan2 return INF? Marko Rauhamaa <marko@pacujo.net> - 2016-06-30 09:32 +0300
                Re: Can math.atan2 return INF? Random832 <random832@fastmail.com> - 2016-06-29 09:55 -0400
                Re: Can math.atan2 return INF? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2016-06-26 11:15 +1200
                Re: Can math.atan2 return INF? MRAB <python@mrabarnett.plus.com> - 2016-06-26 00:31 +0100
                Re: Can math.atan2 return INF? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-06-23 20:04 +0100
                Re: Can math.atan2 return INF? pdorange@pas-de-pub-merci.mac.com (Pierre-Alain Dorange) - 2016-06-23 19:07 +0200
              Re: Can math.atan2 return INF? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-06-23 15:37 +0100

csiph-web