{"abstract":"A mathematically nonzero residual disappears when large positive and negative terms cancel.","category":"Floating-point arithmetic","checks":7,"contract":"Sum a finite sequence of finite binary floating-point values using math.fsum semantics. These bounded fixtures have exactly representable expected residuals and do not overflow the final result.","evaluation_group":"model-d0781fa714c08af3","failed_approach":"A single Kahan compensation term is still lost for some severe cancellation orderings; compensation is not a universal accuracy guarantee.","family":"num-cancellation-summation","id":"FA-321","implementations":{"attempt":{"sha256":"237bcce6055006b6423aca9fdce9c3cf4e0565f4538393cb06d0db09458db130","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nN = 1\nobservations = []\ndef solve(values):\n    total, correction = 0.0, 0.0\n    for value in values:\n        adjusted = value - correction\n        updated = total + adjusted\n        correction = (updated - total) - adjusted\n        total = updated\n    return total\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nlarge = float(2 ** 54)\nresidual = N + 0.125\ncheck('small residual between cancelling large terms', solve([large, residual, -large]), residual)\ncheck('negative residual between cancelling large terms', solve([-large, -residual, large]), -residual)\ncheck('small terms before cancellation', solve([0.25] * N + [large, -large]), N / 4)\ncheck('ordinary exact binary fractions', solve([0.125, 0.25, 0.5] * N), 0.875 * N)\ncheck('opposite terms cancel exactly', solve([large, -large] * N), 0.0)\ncheck('one finite observation', solve([residual]), residual)\ncheck('empty sum', solve([]), 0.0)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"6dd777c539e82241d7c7d692a318b4b701bc9cbecc2057e2a9c96f8a52dfd558","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nN = 1\nobservations = []\ndef solve(values):\n    total = 0.0\n    for value in values:\n        total += value\n    return total\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nlarge = float(2 ** 54)\nresidual = N + 0.125\ncheck('small residual between cancelling large terms', solve([large, residual, -large]), residual)\ncheck('negative residual between cancelling large terms', solve([-large, -residual, large]), -residual)\ncheck('small terms before cancellation', solve([0.25] * N + [large, -large]), N / 4)\ncheck('ordinary exact binary fractions', solve([0.125, 0.25, 0.5] * N), 0.875 * N)\ncheck('opposite terms cancel exactly', solve([large, -large] * N), 0.0)\ncheck('one finite observation', solve([residual]), residual)\ncheck('empty sum', solve([]), 0.0)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"fixed":{"sha256":"324c2ff074f9def0f207d84c6897d4d1be72bcbea9565a7972037479efddbbe9","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nN = 1\nobservations = []\ndef solve(values):\n    return math.fsum(values)\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nlarge = float(2 ** 54)\nresidual = N + 0.125\ncheck('small residual between cancelling large terms', solve([large, residual, -large]), residual)\ncheck('negative residual between cancelling large terms', solve([-large, -residual, large]), -residual)\ncheck('small terms before cancellation', solve([0.25] * N + [large, -large]), N / 4)\ncheck('ordinary exact binary fractions', solve([0.125, 0.25, 0.5] * N), 0.875 * N)\ncheck('opposite terms cancel exactly', solve([large, -large] * N), 0.0)\ncheck('one finite observation', solve([residual]), residual)\ncheck('empty sum', solve([]), 0.0)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":" This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"num-cancellation-summation","generated_at":"2026-09-29T14:36:52.068094+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Mixed-sign measurements with a large dynamic range can expose weaknesses that positive-only sums do not. The experiment compares ordinary accumulation, Kahan accumulation, and standard-library accurate summation.","repair":"Use an accurate summation routine that retains multiple partial sums across magnitude changes.","root_cause":"Sequential floating-point accumulation rounds away a small term before the compensating large term arrives.","sha256":"4d4e34d217ad2be9bb4ba43caf527c3724b48c9ce168b549e5786068e9dff41e","title":"Large cancelling terms erase a small summand · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":34.135,"exit_code":1,"observations":[{"actual":2.0,"check":"small residual between cancelling large terms","expected":1.125,"passed":false},{"actual":-2.0,"check":"negative residual between cancelling large terms","expected":-1.125,"passed":false},{"actual":0.0,"check":"small terms before cancellation","expected":0.25,"passed":false},{"actual":0.875,"check":"ordinary exact binary fractions","expected":0.875,"passed":true},{"actual":0.0,"check":"opposite terms cancel exactly","expected":0.0,"passed":true},{"actual":1.125,"check":"one finite observation","expected":1.125,"passed":true},{"actual":0.0,"check":"empty sum","expected":0.0,"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"small residual between cancelling large terms\", \"actual\": 2.0, \"expected\": 1.125, \"passed\": false}, {\"check\": \"negative residual between cancelling large terms\", \"actual\": -2.0, \"expected\": -1.125, \"passed\": false}, {\"check\": \"small terms before cancellation\", \"actual\": 0.0, \"expected\": 0.25, \"passed\": false}, {\"check\": \"ordinary exact binary fractions\", \"actual\": 0.875, \"expected\": 0.875, \"passed\": true}, {\"check\": \"opposite terms cancel exactly\", \"actual\": 0.0, \"expected\": 0.0, \"passed\": true}, {\"check\": \"one finite observation\", \"actual\": 1.125, \"expected\": 1.125, \"passed\": true}, {\"check\": \"empty sum\", \"actual\": 0.0, \"expected\": 0.0, \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":31.203,"exit_code":1,"observations":[{"actual":0.0,"check":"small residual between cancelling large terms","expected":1.125,"passed":false},{"actual":0.0,"check":"negative residual between cancelling large terms","expected":-1.125,"passed":false},{"actual":0.0,"check":"small terms before cancellation","expected":0.25,"passed":false},{"actual":0.875,"check":"ordinary exact binary fractions","expected":0.875,"passed":true},{"actual":0.0,"check":"opposite terms cancel exactly","expected":0.0,"passed":true},{"actual":1.125,"check":"one finite observation","expected":1.125,"passed":true},{"actual":0.0,"check":"empty sum","expected":0.0,"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"small residual between cancelling large terms\", \"actual\": 0.0, \"expected\": 1.125, \"passed\": false}, {\"check\": \"negative residual between cancelling large terms\", \"actual\": 0.0, \"expected\": -1.125, \"passed\": false}, {\"check\": \"small terms before cancellation\", \"actual\": 0.0, \"expected\": 0.25, \"passed\": false}, {\"check\": \"ordinary exact binary fractions\", \"actual\": 0.875, \"expected\": 0.875, \"passed\": true}, {\"check\": \"opposite terms cancel exactly\", \"actual\": 0.0, \"expected\": 0.0, \"passed\": true}, {\"check\": \"one finite observation\", \"actual\": 1.125, \"expected\": 1.125, \"passed\": true}, {\"check\": \"empty sum\", \"actual\": 0.0, \"expected\": 0.0, \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":35.021,"exit_code":0,"observations":[{"actual":1.125,"check":"small residual between cancelling large terms","expected":1.125,"passed":true},{"actual":-1.125,"check":"negative residual between cancelling large terms","expected":-1.125,"passed":true},{"actual":0.25,"check":"small terms before cancellation","expected":0.25,"passed":true},{"actual":0.875,"check":"ordinary exact binary fractions","expected":0.875,"passed":true},{"actual":0.0,"check":"opposite terms cancel exactly","expected":0.0,"passed":true},{"actual":1.125,"check":"one finite observation","expected":1.125,"passed":true},{"actual":0.0,"check":"empty sum","expected":0.0,"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"small residual between cancelling large terms\", \"actual\": 1.125, \"expected\": 1.125, \"passed\": true}, {\"check\": \"negative residual between cancelling large terms\", \"actual\": -1.125, \"expected\": -1.125, \"passed\": true}, {\"check\": \"small terms before cancellation\", \"actual\": 0.25, \"expected\": 0.25, \"passed\": true}, {\"check\": \"ordinary exact binary fractions\", \"actual\": 0.875, \"expected\": 0.875, \"passed\": true}, {\"check\": \"opposite terms cancel exactly\", \"actual\": 0.0, \"expected\": 0.0, \"passed\": true}, {\"check\": \"one finite observation\", \"actual\": 1.125, \"expected\": 1.125, \"passed\": true}, {\"check\": \"empty sum\", \"actual\": 0.0, \"expected\": 0.0, \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}