On 10/14/06, Tim Hochberg <[EMAIL PROTECTED]> wrote:
Yep, that works. There is a version in my zeros module in scipy also, it's just that ISTR seeing similar code in numpy somewhere and I was hoping Travis would tell me where ;) Grep is my friend, I guess, ... ah, here it is
In [140]: np.MachAr(np.single).eps
Out[140]: 1.1920928955078125e-07
In [141]: np.MachAr(np.double).eps
Out[141]: 2.2204460492503131e-16
Chuck
Charles R Harris wrote:
>
>
> On 10/14/06, *A. M. Archibald* <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED] >> wrote:
[SNIP]
>
>
> Hmmm, I wonder if we have a dictionary of precisions indexed by dtype
> somewhere?
Here's some code I stole from somewhere for computing EPS. It would easy
enough to generate the dictionary you are looking for at startup using
this. I can't recall the pedigree of this code though, so caveat emptor:
def bits_of_precision(dtype):
dtype)
i = 0
while not np.alltrue(one + (one / 2.**i) == one):
i += 1
return i - 1
Yep, that works. There is a version in my zeros module in scipy also, it's just that ISTR seeing similar code in numpy somewhere and I was hoping Travis would tell me where ;) Grep is my friend, I guess, ... ah, here it is
In [140]: np.MachAr(np.single).eps
Out[140]: 1.1920928955078125e-07
In [141]: np.MachAr(np.double).eps
Out[141]: 2.2204460492503131e-16
Chuck
------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion