{"abstract":"Stochastic rounding truncates the probability before sampling.","category":"Floating-point arithmetic","checks":10,"contract":"Stipulated stochastic rounding of nonnegative significand with exact dyadic remainder rem/2**k. Draw is uniform integer in [0,2**k); increment magnitude iff draw<rem, then apply sign. Exact results never increment. Return rounded value and whether magnitude incremented.","contract_signature":"q,rem,k,draw,sign","evaluation_group":"s3-float-stochastic-round","failed_approach":"The attempted local correction inc=round(draw/(1<<k))<round(rem/(1<<k)) still violates the explicit regression fixtures.","family":"s3-floating_point_arithmetic-stochastic-round-probability-quantization","id":"FA-16671","implementations":{"attempt":{"sha256":"b6ebded52c4298f403ed45f188d056e39970f0b1c8e9bb4f52c552e092e10760","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nimport struct\nN = 1\nobservations = []\ndef solve(q,rem,k,draw,sign):\n    if k<0 or rem<0 or rem>=(1<<k) or draw<0 or draw>=(1<<k): return 'invalid'\n    if rem==0: return [sign*q,False]\n    inc=round(draw/(1<<k))<round(rem/(1<<k))\n    return [sign*(q+int(inc)),inc]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('draw below', solve(N,3,3,2,1), [N+1,True])\ncheck('draw equality', solve(N,3,3,3,1), [N,False])\ncheck('draw above', solve(N,3,3,7,1), [N,False])\ncheck('negative increment', solve(N,3,3,1,-1), [-N-1,True])\ncheck('negative no increment', solve(N,3,3,5,-1), [-N,False])\ncheck('exact', solve(N,0,3,0,1), [N,False])\ncheck('invalid remainder', solve(N,8,3,0,1), \"invalid\")\ncheck('invalid draw', solve(N,3,3,8,1), \"invalid\")\ncheck('large resolution', solve(N,1,54,0,1), [N+1,True])\ncheck('resolution boundary', solve(N,1,54,1,1), [N,False])\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":"00a7df5df05605bc1ae18db3de4e46772f10151ebfcab3566330d16a2dde2a3f","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nimport struct\nN = 1\nobservations = []\ndef solve(q,rem,k,draw,sign):\n    if k<0 or rem<0 or rem>=(1<<k) or draw<0 or draw>=(1<<k): return 'invalid'\n    if rem==0: return [sign*q,False]\n    inc=draw/(1<<k)<rem//(1<<k)\n    return [sign*(q+int(inc)),inc]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('draw below', solve(N,3,3,2,1), [N+1,True])\ncheck('draw equality', solve(N,3,3,3,1), [N,False])\ncheck('draw above', solve(N,3,3,7,1), [N,False])\ncheck('negative increment', solve(N,3,3,1,-1), [-N-1,True])\ncheck('negative no increment', solve(N,3,3,5,-1), [-N,False])\ncheck('exact', solve(N,0,3,0,1), [N,False])\ncheck('invalid remainder', solve(N,8,3,0,1), \"invalid\")\ncheck('invalid draw', solve(N,3,3,8,1), \"invalid\")\ncheck('large resolution', solve(N,1,54,0,1), [N+1,True])\ncheck('resolution boundary', solve(N,1,54,1,1), [N,False])\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-stochastic-round-probability-quantization","generated_at":"2026-09-29T14:39:38.704297+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.","root_cause":"Stochastic rounding truncates the probability before sampling. The faulty expression is inc=draw/(1<<k)<rem//(1<<k).","sha256":"22576a4c156d8e86ab91ebdc9d5bd5d5fbe65d4daadb0215cff55717bd5214c4","title":"Stochastic rounding truncates the probability before sampling · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verified":true,"visibility":"public","verification":{"attempt":{"elapsed_ms":40.785,"exit_code":1,"observations":[{"actual":[1,false],"check":"draw below","expected":[2,true],"passed":false},{"actual":[1,false],"check":"draw equality","expected":[1,false],"passed":true},{"actual":[1,false],"check":"draw above","expected":[1,false],"passed":true},{"actual":[-1,false],"check":"negative increment","expected":[-2,true],"passed":false},{"actual":[-1,false],"check":"negative no increment","expected":[-1,false],"passed":true},{"actual":[1,false],"check":"exact","expected":[1,false],"passed":true},{"actual":"invalid","check":"invalid remainder","expected":"invalid","passed":true},{"actual":"invalid","check":"invalid draw","expected":"invalid","passed":true},{"actual":[1,false],"check":"large resolution","expected":[2,true],"passed":false},{"actual":[1,false],"check":"resolution boundary","expected":[1,false],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"draw below\", \"actual\": [1, false], \"expected\": [2, true], \"passed\": false}, {\"check\": \"draw equality\", \"actual\": [1, false], \"expected\": [1, false], \"passed\": true}, {\"check\": \"draw above\", \"actual\": [1, false], \"expected\": [1, false], \"passed\": true}, {\"check\": \"negative increment\", \"actual\": [-1, false], \"expected\": [-2, true], \"passed\": false}, {\"check\": \"negative no increment\", \"actual\": [-1, false], \"expected\": [-1, false], \"passed\": true}, {\"check\": \"exact\", \"actual\": [1, false], \"expected\": [1, false], \"passed\": true}, {\"check\": \"invalid remainder\", \"actual\": \"invalid\", \"expected\": \"invalid\", \"passed\": true}, {\"check\": \"invalid draw\", \"actual\": \"invalid\", \"expected\": \"invalid\", \"passed\": true}, {\"check\": \"large resolution\", \"actual\": [1, false], \"expected\": [2, true], \"passed\": false}, {\"check\": \"resolution boundary\", \"actual\": [1, false], \"expected\": [1, false], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":42.928,"exit_code":1,"observations":[{"actual":[1,false],"check":"draw below","expected":[2,true],"passed":false},{"actual":[1,false],"check":"draw equality","expected":[1,false],"passed":true},{"actual":[1,false],"check":"draw above","expected":[1,false],"passed":true},{"actual":[-1,false],"check":"negative increment","expected":[-2,true],"passed":false},{"actual":[-1,false],"check":"negative no increment","expected":[-1,false],"passed":true},{"actual":[1,false],"check":"exact","expected":[1,false],"passed":true},{"actual":"invalid","check":"invalid remainder","expected":"invalid","passed":true},{"actual":"invalid","check":"invalid draw","expected":"invalid","passed":true},{"actual":[1,false],"check":"large resolution","expected":[2,true],"passed":false},{"actual":[1,false],"check":"resolution boundary","expected":[1,false],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"draw below\", \"actual\": [1, false], \"expected\": [2, true], \"passed\": false}, {\"check\": \"draw equality\", \"actual\": [1, false], \"expected\": [1, false], \"passed\": true}, {\"check\": \"draw above\", \"actual\": [1, false], \"expected\": [1, false], \"passed\": true}, {\"check\": \"negative increment\", \"actual\": [-1, false], \"expected\": [-2, true], \"passed\": false}, {\"check\": \"negative no increment\", \"actual\": [-1, false], \"expected\": [-1, false], \"passed\": true}, {\"check\": \"exact\", \"actual\": [1, false], \"expected\": [1, false], \"passed\": true}, {\"check\": \"invalid remainder\", \"actual\": \"invalid\", \"expected\": \"invalid\", \"passed\": true}, {\"check\": \"invalid draw\", \"actual\": \"invalid\", \"expected\": \"invalid\", \"passed\": true}, {\"check\": \"large resolution\", \"actual\": [1, false], \"expected\": [2, true], \"passed\": false}, {\"check\": \"resolution boundary\", \"actual\": [1, false], \"expected\": [1, false], \"passed\": true}], \"passed\": false}\n"}},"member_only":{"stages":["fixed"],"fields":["implementations.fixed","verification.fixed","harness","repair"],"note":"The verified repair, its recorded checks, the repair description, and the scoring harness are available to members."}}