[Numpy-discussion] what goes wrong with cos(), sin()
Charles R Harris
charlesr.harris@gmail....
Wed Feb 21 17:24:47 CST 2007
On 2/21/07, Robert Kern <robert.kern@gmail.com> wrote:
>
> Christopher Barker wrote:
> > Robert Kern wrote:
> >> Christopher Barker wrote:
> >>> I wonder if there are any C math libs that do a better job than you'd
> >>> expect from standard FP? (short of unlimited precision ones)
> >> With respect to π and the zeros of sin() and cos()? Not really.
<snip>
Well, you can always use long double if it is implemented on your platform.
> You
> will have to construct a value for π yourself, though. I'm afraid that we
> don't
> really make that easy.
>
> --
pi = 3. 1415926535 8979323846 2643383279 5028841971 6939937510 5820974944
5923078164 0628620899 8628034825 3421170679 8214808651 *...
*
I dont know what that looks like when converted to long double. Lessee,
In [1]: import numpy
In [2]: pi = numpy.float128(3.1415926535897932384626433832795028841971)
In [3]: numpy.pi - pi
Out[3]: 0.0
In [7]: '%25.20f'%numpy.pi
Out[7]: ' 3.14159265358979311600'
In [8]: '%25.20f'%pi
Out[8]: ' 3.14159265358979311600'
I think we have a bug. Or else extended arithmetic isn't supported on this
machine.
Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20070221/e0f7a654/attachment-0001.html
More information about the Numpy-discussion
mailing list