[issue8309] Sin(x) is Wrong

Mark Dickinson report at bugs.python.org
Sun Apr 4 11:59:12 CEST 2010

Mark Dickinson <dickinsm at gmail.com> added the comment:

> Python 3.1.2 -- 32 bit gives sin(2^60) = -0.7391806966492228

Interesting.  I get 

>>> sin(2.**60)

On both OS X 10.6.3 (64-bit build) and OS X 10.5.something (32-bit build).  But this is all down to the platform math library, of course.

I agree it's not ideal, but it's not really in Python's power to fix this, without adding a huge extra maintenance burden (from adding the necessary high-precision arithmetic to Python itself) or another external dependency.

You could always try to come up with a patch that adds a configure option for linking Python's math library into MPFR instead of the system math library.  (crlibm would also work, and would be faster;  it doesn't seem to be so well maintained these days though;  Pari/GP isn't such a great option since its floating-point model isn't so compatible with IEEE 754).


Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list