[Numpy-discussion] what goes wrong with cos(), sin()
David Goldsmith
David.L.Goldsmith@noaa....
Wed Feb 21 14:27:02 CST 2007
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. If
> numpy.sin(numpy.pi) were to give you 0.0, it would be *wrong*. numpy.sin() is
> supposed to give you the most accurate result representable in double-precision
> for the input you gave it. numpy.pi is not π.
>
>
True, but since the string literal "numpy.pi" is not the same as the
string literal "3.1415926535897931" there's no reason in principle why
"numpy.py" couldn't symbolically represent the exact value; of course,
since numpy does not otherwise support symbolic computation, such an
adoption would be frivolous and rather silly (but then the Pythons were
never afraid of being silly). :-)
DG
More information about the Numpy-discussion
mailing list