[Numpy-discussion] Solaris Sparc build broken

Charles R Harris charlesr.harris@gmail....
Thu Nov 5 00:57:54 CST 2009

On Wed, Nov 4, 2009 at 11:30 PM, David Cournapeau <
david@ar.media.kyoto-u.ac.jp> wrote:

> Charles R Harris wrote:
> >
> > I don't think it's that bad. Leaving out the ppc and sticking to ieee,
> > there is only double precision, extended precision and quad precision
> > versions of long double and they  are easily determined at run time.
> How would you determine this at runtime ?
Excepting the PPC, just loop adding a number to one, dividing it by two at
each iteration, and stop when the result is equal to one. There has been a
version of that in the scipy zeros module since forever.

PyMODINIT_FUNC init_zeros(void)
        double tol;

        /* Determine relative precision of doubles, assumes binary */
        for(tol = 1; tol + 1 != 1; tol /= 2);
        scipy_zeros_rtol = 2*tol;

        Py_InitModule("_zeros", Zerosmethods);

Or you could just do byte comparisons against known numbers.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20091104/9bfd2057/attachment-0001.html 

More information about the NumPy-Discussion mailing list