More int and float attributes

Robert Kern robert.kern at gmail.com
Sun Aug 6 03:47:08 EDT 2006


Paddy wrote:
> Question: do the scientific packages supported by Python supply this
> data in a regular manner?

For floating point types, at least.

In [11]: from numpy import *

In [12]: print finfo(float32)
Machine parameters for <type 'float32scalar'>
---------------------------------------------------------------------
precision=  6   resolution=  1.0000000e-06
machep=   -23   eps=       1.1920929e-07
negep =   -24   epsneg=    5.9604645e-08
minexp=  -126   tiny=      1.1754944e-38
maxexp=   128   max=       3.4028235e+38
nexp  =     8   min=       -max
---------------------------------------------------------------------


In [13]: print finfo(float64)
Machine parameters for <type 'float64scalar'>
---------------------------------------------------------------------
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
---------------------------------------------------------------------


-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco




More information about the Python-list mailing list