Mark Dickinson <dicki...@gmail.com> added the comment:

Johannes: note that the reduction needs to be by 2*pi, not pi.  The 
remainder_near method is slightly better than the modulo operator here:
remainder_near reduces to the range [-pi, pi], while the modulo operator 
reduces to the range (-2*pi, 2*pi), so ends up passing larger arguments to the 
Taylor series.  (And it's a nice excuse to show what remainder_near is good 
for!)  Also, the reduction should happen *after* the temporary increase in 
context precision.

Here's a doc patch, that just adds a single line:

x = x.remainder_near(2*pi())

after getcontext().prec += 2, for both the sin and cos recipes.  It also 
removes the float and complex examples in the docstrings, since remainder_near 
doesn't exist for those types.

Raymond, is this change okay with you?

----------
keywords: +patch
stage: test needed -> patch review
versions: +Python 2.7, Python 3.1, Python 3.2
Added file: http://bugs.python.org/file15989/issue7770.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue7770>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to