GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Accuracy issues of sum() specialization for floats/complexes · Issue #122234 · python/cpython Closed Labels interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error DescriptionBug reportBug description:Unfortunately, #121176 was merged with a bug: Lines 2749 to 2755 in e968121
L2751 lacks cs_add(). Sorry for that. Reproducer: sum([2j, 1., 10E100, 1., -10E100]) (should be 2+2j). I'll provide a patch.
But maybe cases for integer arguments also should use compensated summation? E.g.: Lines 2689 to 2698 in e968121
on L2694 (and use PyLong_AsDouble()). An example:
>>> sum([1.0, 10E100, 1.0, -10E100]) 2.0 >>> sum([1.0, 10**100, 1.0, -10**100]) # huh? 0.0 I would guess, that integer values in this case are treated as exact and they are allowed to smash floating-point result to garbage. But... This looks as a bug for me. >>> math.fsum([1.0, 10**100, 1.0, -10**100]) 2.0 CPython versions tested on:CPython main branch Operating systems tested on:No response Linked PRsActivity
MetadataMetadataAssigneesLabelsinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error ProjectsMilestoneRelationshipsDevelopmentIssue actions | ||||||||||||||||||||||||||||||||||
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |