Kahan summation: Difference between revisions
Content added Content deleted
(→{{header|Python}}: getcontext.) |
(→{{header|Python}}: Contrast Pythons sum()) |
||
Line 32: | Line 32: | ||
>>> kahansum([a, b, c]) |
>>> kahansum([a, b, c]) |
||
Decimal('10005.9') |
Decimal('10005.9') |
||
>>> |
|||
>>> |
|||
>>> sum([a, b, c]) |
|||
Decimal('10005.8') |
|||
>>> # it seems Python's sum() doesn't make use of this technique. |
|||
>>> |
>>> |
||
>>> # More info on the current Decimal context: |
>>> # More info on the current Decimal context: |