[SciPy-user] fft numerical precision

Travis Oliphant oliphant.travis at ieee.org
Thu Feb 16 08:29:19 CST 2006


Ryan Krauss wrote:

>Thanks, I am feeling much better about this.
>
>I actually found something like this on the internet that is really
>helpful to me:
>In [1]: m=1.0
>In [2]: e=m
>In [3]: while m+e>m:
>   ...:     e=e/2.0
>   ...:
>
>In [4]: e
>Out[4]: 1.1102230246251565e-16
>
>In [5]: m=1e-4
>In [6]: e=m
>
>In [8]: while m+e>m:
>   ...:     e=e/2.0
>   ...:
>
>In [9]: e
>Out[9]: 5.551115123125783e-21
>
>In [10]: m*(2.0**-52)
>Out[10]: 2.2204460492503132e-20
>
>Ryan
>  
>
There is some code in numpy/lib/machar.py  that you might find useful in 
this regard.

-Travis



More information about the SciPy-user mailing list