[SciPy-dev] Machine precision

Pearu Peterson pearu at scipy.org
Thu Nov 27 06:48:02 CST 2003



On Thu, 27 Nov 2003, Nils Wagner wrote:

> Dear experts,
> 
> Is it possible to implement eps as a constant (similar to pi or e)
> representin the precision of the machine in scipy ?

No, because eps is not an universal constant (such as pi or e) but
depends on the machine architecture.

However, scipy provides (calculates) machine constants in 
scipy_base.machar module.
For example (in ipython),

In [1]: from scipy_base import machar_double

In [2]: machar_double.eps
Out[2]: 2.22044604925e-16

In [3]: machar_double.epsneg
Out[3]: 1.11022302463e-16

In [4]: from scipy_base import machar_single

In [5]: machar_single.eps
Out[5]: 1.19209289551e-07

In [6]: machar_single.epsneg
Out[6]: 5.96046447754e-08

For more information, see

  help(machar_double.__class__)

HTH,
Pearu



More information about the Scipy-dev mailing list