{"abstract":"Cosine decrement subtracts one after rounding.","category":"Floating-point arithmetic","checks":7,"contract":"Evaluate cos(x)-1 for finite x without cancellation using the half-angle identity. Finite results are rendered to eleven significant decimal digits; modeled domain violations and arithmetic errors are explicit strings.","evaluation_group":"s3-float-cosm1","failed_approach":"The attempted local correction result=min(0.0,math.cos(x)-1) still violates the explicit regression fixtures.","family":"s3-floating_point_arithmetic-cosm1-cosine-cancellation","id":"FA-16356","implementations":{"attempt":{"sha256":"4bcbbb0f8e0e56c1d1eb9c004036309efc7de77541cb4e9f25bee9a6c57734e7","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nimport struct\ndef render(x):\n    if math.isnan(x): return 'nan'\n    if math.isinf(x): return '-infinity' if x<0 else '+infinity'\n    return format(x,'.11g')\n\nN = 1\nobservations = []\ndef solve(x):\n    try:\n        if x==0: return '-0'\n        s=math.sin(x/2)\n        result=min(0.0,math.cos(x)-1)\n        return render(result)\n    except (ValueError, OverflowError, ZeroDivisionError, TypeError):\n        return \"arithmetic-error\"\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('tiny', solve(N*2.0**-30), render(-0.5*(N*2.0**-30)**2))\ncheck('negative tiny', solve(-N*2.0**-30), render(-0.5*(N*2.0**-30)**2))\ncheck('normal', solve(float(N)), render(-2*math.sin(N/2)**2))\ncheck('negative normal', solve(-float(N)), render(-2*math.sin(N/2)**2))\ncheck('zero', solve(0.0), \"-0\")\ncheck('pi', solve(math.pi), \"-2\")\ncheck('half pi', solve(math.pi/2), \"-1\")\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":"62ee63816fdfdf0ba30736c8c469bbed37454b9784e083324e6ecf68d1249c4e","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nimport struct\ndef render(x):\n    if math.isnan(x): return 'nan'\n    if math.isinf(x): return '-infinity' if x<0 else '+infinity'\n    return format(x,'.11g')\n\nN = 1\nobservations = []\ndef solve(x):\n    try:\n        if x==0: return '-0'\n        s=math.sin(x/2)\n        result=math.cos(x)-1\n        return render(result)\n    except (ValueError, OverflowError, ZeroDivisionError, TypeError):\n        return \"arithmetic-error\"\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('tiny', solve(N*2.0**-30), render(-0.5*(N*2.0**-30)**2))\ncheck('negative tiny', solve(-N*2.0**-30), render(-0.5*(N*2.0**-30)**2))\ncheck('normal', solve(float(N)), render(-2*math.sin(N/2)**2))\ncheck('negative normal', solve(-float(N)), render(-2*math.sin(N/2)**2))\ncheck('zero', solve(0.0), \"-0\")\ncheck('pi', solve(math.pi), \"-2\")\ncheck('half pi', solve(math.pi/2), \"-1\")\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":"574c04d51a1b28a816c764b6b202eef5b0e3c80f7a3240d643a5f67654f8271c","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nimport struct\ndef render(x):\n    if math.isnan(x): return 'nan'\n    if math.isinf(x): return '-infinity' if x<0 else '+infinity'\n    return format(x,'.11g')\n\nN = 1\nobservations = []\ndef solve(x):\n    try:\n        if x==0: return '-0'\n        s=math.sin(x/2)\n        result=-2*s*s\n        return render(result)\n    except (ValueError, OverflowError, ZeroDivisionError, TypeError):\n        return \"arithmetic-error\"\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('tiny', solve(N*2.0**-30), render(-0.5*(N*2.0**-30)**2))\ncheck('negative tiny', solve(-N*2.0**-30), render(-0.5*(N*2.0**-30)**2))\ncheck('normal', solve(float(N)), render(-2*math.sin(N/2)**2))\ncheck('negative normal', solve(-float(N)), render(-2*math.sin(N/2)**2))\ncheck('zero', solve(0.0), \"-0\")\ncheck('pi', solve(math.pi), \"-2\")\ncheck('half pi', solve(math.pi/2), \"-1\")\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":"Controlled binary64 or explicitly stipulated miniature format; no hardware exception flags or platform floating environment are modeled. 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":"s3-floating_point_arithmetic-cosm1-cosine-cancellation","generated_at":"2026-09-29T14:39:35.405501+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"An offline floating representation model isolates a reproducible arithmetic fault.","repair":"Apply the contract at this fault site using result=-2*s*s.","root_cause":"Cosine decrement subtracts one after rounding. The faulty expression is result=math.cos(x)-1.","sha256":"20460f7035b818a7a53181896d32a42cfe1eb031b9103c20cf95409d43ae497e","title":"Cosine decrement subtracts one after rounding · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":43.151,"exit_code":1,"observations":[{"actual":"0","check":"tiny","expected":"-4.3368086899e-19","passed":false},{"actual":"0","check":"negative tiny","expected":"-4.3368086899e-19","passed":false},{"actual":"-0.45969769413","check":"normal","expected":"-0.45969769413","passed":true},{"actual":"-0.45969769413","check":"negative normal","expected":"-0.45969769413","passed":true},{"actual":"-0","check":"zero","expected":"-0","passed":true},{"actual":"-2","check":"pi","expected":"-2","passed":true},{"actual":"-1","check":"half pi","expected":"-1","passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"tiny\", \"actual\": \"0\", \"expected\": \"-4.3368086899e-19\", \"passed\": false}, {\"check\": \"negative tiny\", \"actual\": \"0\", \"expected\": \"-4.3368086899e-19\", \"passed\": false}, {\"check\": \"normal\", \"actual\": \"-0.45969769413\", \"expected\": \"-0.45969769413\", \"passed\": true}, {\"check\": \"negative normal\", \"actual\": \"-0.45969769413\", \"expected\": \"-0.45969769413\", \"passed\": true}, {\"check\": \"zero\", \"actual\": \"-0\", \"expected\": \"-0\", \"passed\": true}, {\"check\": \"pi\", \"actual\": \"-2\", \"expected\": \"-2\", \"passed\": true}, {\"check\": \"half pi\", \"actual\": \"-1\", \"expected\": \"-1\", \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":44.088,"exit_code":1,"observations":[{"actual":"0","check":"tiny","expected":"-4.3368086899e-19","passed":false},{"actual":"0","check":"negative tiny","expected":"-4.3368086899e-19","passed":false},{"actual":"-0.45969769413","check":"normal","expected":"-0.45969769413","passed":true},{"actual":"-0.45969769413","check":"negative normal","expected":"-0.45969769413","passed":true},{"actual":"-0","check":"zero","expected":"-0","passed":true},{"actual":"-2","check":"pi","expected":"-2","passed":true},{"actual":"-1","check":"half pi","expected":"-1","passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"tiny\", \"actual\": \"0\", \"expected\": \"-4.3368086899e-19\", \"passed\": false}, {\"check\": \"negative tiny\", \"actual\": \"0\", \"expected\": \"-4.3368086899e-19\", \"passed\": false}, {\"check\": \"normal\", \"actual\": \"-0.45969769413\", \"expected\": \"-0.45969769413\", \"passed\": true}, {\"check\": \"negative normal\", \"actual\": \"-0.45969769413\", \"expected\": \"-0.45969769413\", \"passed\": true}, {\"check\": \"zero\", \"actual\": \"-0\", \"expected\": \"-0\", \"passed\": true}, {\"check\": \"pi\", \"actual\": \"-2\", \"expected\": \"-2\", \"passed\": true}, {\"check\": \"half pi\", \"actual\": \"-1\", \"expected\": \"-1\", \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":41.859,"exit_code":0,"observations":[{"actual":"-4.3368086899e-19","check":"tiny","expected":"-4.3368086899e-19","passed":true},{"actual":"-4.3368086899e-19","check":"negative tiny","expected":"-4.3368086899e-19","passed":true},{"actual":"-0.45969769413","check":"normal","expected":"-0.45969769413","passed":true},{"actual":"-0.45969769413","check":"negative normal","expected":"-0.45969769413","passed":true},{"actual":"-0","check":"zero","expected":"-0","passed":true},{"actual":"-2","check":"pi","expected":"-2","passed":true},{"actual":"-1","check":"half pi","expected":"-1","passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"tiny\", \"actual\": \"-4.3368086899e-19\", \"expected\": \"-4.3368086899e-19\", \"passed\": true}, {\"check\": \"negative tiny\", \"actual\": \"-4.3368086899e-19\", \"expected\": \"-4.3368086899e-19\", \"passed\": true}, {\"check\": \"normal\", \"actual\": \"-0.45969769413\", \"expected\": \"-0.45969769413\", \"passed\": true}, {\"check\": \"negative normal\", \"actual\": \"-0.45969769413\", \"expected\": \"-0.45969769413\", \"passed\": true}, {\"check\": \"zero\", \"actual\": \"-0\", \"expected\": \"-0\", \"passed\": true}, {\"check\": \"pi\", \"actual\": \"-2\", \"expected\": \"-2\", \"passed\": true}, {\"check\": \"half pi\", \"actual\": \"-1\", \"expected\": \"-1\", \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}