rcond in polyfit

Charles R Harris charlesr.harris at gmail.com
Sat Oct 14 19:44:27 CDT 2006


On 10/14/06, Tim Hochberg <tim.hochberg at ieee.org> wrote:
>
> Charles R Harris wrote:
> >
> >
> > On 10/14/06, *A. M. Archibald* <peridot.faceted at gmail.com
> > <mailto:peridot.faceted at gmail.com>> 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):
>         one = np.array([1], 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20061014/8980e389/attachment-0001.html 
-------------- next part --------------
-------------------------------------------------------------------------
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
-------------- next part --------------
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


More information about the Numpy-discussion mailing list