Why `divmod(float('inf'), 1) == (float('nan'), float('nan'))`
chris.barker at noaa.gov
chris.barker at noaa.gov
Thu Sep 18 12:35:48 EDT 2014
More information about the Python-list mailing list
Thu Sep 18 12:35:48 EDT 2014
- Previous message (by thread): Why `divmod(float('inf'), 1) == (float('nan'), float('nan'))`
- Next message (by thread): Why `divmod(float('inf'), 1) == (float('nan'), float('nan'))`
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Wednesday, September 17, 2014 11:22:42 PM UTC-7, wxjm... at gmail.com wrote: > >>> 1e300*1e300 > > inf > > >>> exp(1e300) > > Traceback (most recent call last): > > File "<eta last command>", line 1, in <module> > > OverflowError: math range error FWIW, numpy is a bit more consistent: In [89]: numpy.exp(1e300) Out[89]: inf This is more critical in numpy, because that result may have been one of a big huge array of values -- you really don't want the entire array operation to raise and Exception because of one odd value. It's be nice if Python's math module did more than simply wrap the default i implementation of the underlying C lib -- it's gotten better over the years (Inf and NaN used to be really hard to get), but still not quite what it could be. -Chris
- Previous message (by thread): Why `divmod(float('inf'), 1) == (float('nan'), float('nan'))`
- Next message (by thread): Why `divmod(float('inf'), 1) == (float('nan'), float('nan'))`
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list