[Tutor] largest and smallest numbers

Kent Johnson kent37 at tds.net
Mon Oct 15 13:53:32 CEST 2007


Dick Moores wrote:
> I pinched it down some more (after dinner):
> 
>  >>> 1.79769313486e+308 * (1.000000000000001 ** 1160)
> 1.7976931348623151e+308
>  >>> 1.79769313486e+308 * (1.000000000000001 ** 1161)
> 1.#INF

This looks promising:
In [8]: x=1.7976931348623157e+308
In [9]: y=0.0000000000000001e+308
In [10]: x+y
Out[10]: inf

Courtesy numpy:
In [4]: from numpy import finfo, float64
In [7]: print finfo(float64)
Machine parameters for <type 'numpy.float64'>
---------------------------------------------------------------------
precision= 15   resolution=  1.0000000000000001e-15
machep=   -52   eps=       2.2204460492503131e-16
negep =   -53   epsneg=    1.1102230246251565e-16
minexp= -1022   tiny=     2.2250738585072014e-308
maxexp=  1024   max=      1.7976931348623157e+308
nexp  =    11   min=       -max
---------------------------------------------------------------------

Kent


More information about the Tutor mailing list