Anonymous user
Kahan summation: Difference between revisions
→{{header|Python}}: getcontext.
(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
|