where in Nan defined

Jussi Piitulainen jpiitula at ling.helsinki.fi
Thu Jan 8 15:55:45 CET 2015


Chris Angelico writes:
> On Fri, Jan 9, 2015 at 1:37 AM, Marko Rauhamaa wrote:
> >
> > True, but that got me thinking: what standard Python math
> > operation evaluates to NaN?
> 
> Subtracting infinity from infinity is one easy way.
> 
> >>> 1e309
> inf
> >>> 1e309-1e309
> nan

I managed to get inf by arithmetic on finite numbers:

  >>> 1e300/1e-300
  inf

  >>> o = 1e300/1e-300 ; o-o
  nan



More information about the Python-list mailing list