This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mark.dickinson
Recipients ahojnnes, georg.brandl, mark.dickinson, rhettinger
Date 2010-01-24.14:46:40
SpamBayes Score 4.107825e-15
Marked as misclassified No
Message-id <1264344403.51.0.570909965501.issue7770@psf.upfronthosting.co.za>
In-reply-to
Content
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?
History
Date User Action Args
2010-01-24 14:46:43mark.dickinsonsetrecipients: + mark.dickinson, georg.brandl, rhettinger, ahojnnes
2010-01-24 14:46:43mark.dickinsonsetmessageid: <1264344403.51.0.570909965501.issue7770@psf.upfronthosting.co.za>
2010-01-24 14:46:41mark.dickinsonlinkissue7770 messages
2010-01-24 14:46:41mark.dickinsoncreate