Jump to content

Kahan summation: Difference between revisions

(New draft task and Python solution.)
 
(→‎{{header|Python}}: getcontext.)
Line 33:
Decimal('10005.9')
>>>
>>> # More info on the current Decimal context:
>>> # Lets try the simple summation with more precision for comparison
>>> getcontext()
Context(prec=6, rounding=ROUND_HALF_EVEN, Emin=-999999, Emax=999999, capitals=1, clamp=0, flags=[Inexact, Rounded], traps=[InvalidOperation, DivisionByZero, Overflow])
>>>
>>>
>>> ## Lets try the simple summation with more precision for comparison
>>> getcontext().prec = 20
>>> (a + b) + c
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.