Kahan summation: Difference between revisions
Content added Content deleted
(New draft task and Python solution.) |
(→{{header|Python}}: getcontext.) |
||
Line 33: | Line 33: | ||
Decimal('10005.9') |
Decimal('10005.9') |
||
>>> |
>>> |
||
>>> # More info on the current Decimal context: |
|||
⚫ | |||
>>> getcontext() |
|||
Context(prec=6, rounding=ROUND_HALF_EVEN, Emin=-999999, Emax=999999, capitals=1, clamp=0, flags=[Inexact, Rounded], traps=[InvalidOperation, DivisionByZero, Overflow]) |
|||
>>> |
|||
>>> |
|||
⚫ | |||
>>> getcontext().prec = 20 |
>>> getcontext().prec = 20 |
||
>>> (a + b) + c |
>>> (a + b) + c |