Re: [Python-Dev] [Python-checkins] python/nondist/peps pep-0343.txt, 1.11, 1.12

2005-05-19 Thread Greg Ewing
Tim Peters wrote: [Raymond Hettinger] from decimal import getcontext, Decimal as D getcontext().prec = 3 D('3.104') + D('2.104') Decimal(5.21) D('3.104') + D('0.000') + D('2.104') Decimal(5.20) the results differ here because D(whatever) ignores context settings; having a common operation

Re: [Python-Dev] [Python-checkins] python/nondist/peps pep-0343.txt, 1.11, 1.12

2005-05-19 Thread Tim Peters
[Greg Ewing] I don't see it's because of that. Even if D(whatever) didn't ignore the context settings, you'd get the same oddity if the numbers came from somewhere else with a different precision. Most users don't change context precision, and in that case there is no operation defined in the

Re: [Python-Dev] [Python-checkins] python/nondist/peps pep-0343.txt, 1.11, 1.12

2005-05-17 Thread Raymond Hettinger
+def sin(x): +Return the sine of x as measured in radians. +do with_extra_precision(): +i, lasts, s, fact, num, sign = 1, 0, x, 1, x, 1 +while s != lasts: +lasts = s +i += 2 +

Re: [Python-Dev] [Python-checkins] python/nondist/peps pep-0343.txt, 1.11, 1.12

2005-05-17 Thread Tim Peters
[Raymond Hettinger] ... One more change: The final return +s should be unindented. It should be at the same level as the do with_extra_precision(). The purpose of the +s is to force the result to be rounded back to the *original* precision. This nuance is likely to be the bane of folks