[issue7770] sin/cos function in decimal-docs

Mark Dickinson report at bugs.python.org
Sun Jan 24 14:26:40 CET 2010


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

I think that recipe is meant more as a simple example of what's possible than as a bullet-proof library function.  Can you suggest changes that would improve accuracy while also keeping the recipe clear and simple?

The usual method for sin/cos is to do an initial reduction by an integral multiple of pi/2 so that the argument lies in [-pi/4, pi/4].  (Though that's still problematic for very large arguments, where pi needs to be computed to many more places than the desired output accuracy.)

Perhaps it would be best to just add a note to the docstring indicating that this is an implementation that's suitable for small arguments; for large arguments, more sophisticated algorithms are needed.

----------
nosy: +rhettinger

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7770>
_______________________________________


More information about the Python-bugs-list mailing list