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

Timothy Hochberg tim.hochberg at ieee.org
Wed Feb 21 16:35:36 EST 2007


On 2/21/07, Christopher Barker <Chris.Barker at noaa.gov> wrote:
>
> Anne Archibald wrote:
> > Or, to see more clearly, try taking (on a pocket calculator, say)
> > sin(3.14) (or even sin(pi)).
>
> This is an interesting point. I took a class from William Kahan once
> (pass/fail, thank god!), and one question he posed to us was:
>
> How many digits of pi is used in an HP calculator?
>
> I never figured out the answer myself, and the question involved the
> info that certain calculations involving pi being accurate to a certain
> degree. I don't have my HP calculator with me right now but I suspect
> that sin(pi) might well evaluate to exactly zero, or closer than 1e-16
> anyway.


Not on my HP calcularor. However, mine is 20+ years old and the label has
worn off so I'm not even sure what model it is any more (15c?). However,
sin(pi) is -4.1e-10 on this calculator, FWIW.


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)
>
> -Chris
>
>
>
> --
> Christopher Barker, Ph.D.
> Oceanographer
>
> Emergency Response Division
> NOAA/NOS/OR&R            (206) 526-6959   voice
> 7600 Sand Point Way NE   (206) 526-6329   fax
> Seattle, WA  98115       (206) 526-6317   main reception
>
> Chris.Barker at noaa.gov
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>



-- 

//=][=\\

tim.hochberg at ieee.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20070221/a5a46693/attachment.html>


More information about the NumPy-Discussion mailing list