[Numpy-discussion] what goes wrong with cos(), sin()

Robert Kern robert.kern at gmail.com
Wed Feb 21 15:08:44 EST 2007


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 π.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco



More information about the NumPy-Discussion mailing list