{"abstract":"A bend worth 12.5 cents reports 12 and fractional values always shrink toward zero.","category":"MIDI event timing","checks":8,"contract":"Input [lsb, msb, range_semitones] with 7-bit data bytes. value = msb*128 + lsb, offset = value - 8192. Positive offsets scale to +range by dividing by 8191, negative ones by 8192. cents = offset * range * 100 / divisor, rounded half away from zero. Invalid bytes or negative range return None.","contract_signature":"x","evaluation_group":"w2-midi-event-timing-pitch-bend-cents","failed_approach":"Python round rounds exact halves to even, so 12.5 still becomes 12.","family":"w2-midi-event-timing-pitch-bend-cents-cent-rounding","id":"FA-81651","implementations":{"attempt":{"sha256":"a6a287db0de85c093b807e7f6be2265b4997726189d15cac667d5750c5f10e29","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(x):\n    if not isinstance(x, list) or len(x) != 3:\n        return None\n    lsb, msb, rng = x\n    if not all(isinstance(v, int) and 0 <= v <= 127 for v in (lsb, msb)) or rng < 0:\n        return None\n    value = (msb << 7) | lsb\n    offset = value - 8192\n    den = 8191 if offset > 0 else 8192\n    c = Fraction(abs(offset) * rng * 100, den)\n    cents = round(c)\n    return cents if offset >= 0 else -cents\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[([0, 64, 2], 0), ([127, 127, 2], 200), ([0, 0, 2], -200), ([0, 96, 2], 100), ([0, 32, 2], -100), ([0, 56, 1], -13), ([0, 24, 1], -63), ([0, 40, 1], -38)], [([0, 96, 2], 100), ([0, 32, 2], -100), ([0, 56, 1], -13), ([0, 24, 1], -63), ([1, 64, 2], 0), ([127, 63, 2], 0), ([0, 72, 12], 150), ([0, 56, 3], -38)], [([0, 56, 1], -13), ([0, 24, 1], -63), ([0, 40, 1], -38), ([127, 63, 2], 0), ([0, 72, 12], 150), ([0, 128, 2], None), ([128, 64, 2], None), ([0, 88, 1], 38)], [([0, 56, 1], -13), ([0, 24, 1], -63), ([0, 56, 3], -38), ([128, 64, 2], None), ([0, 64, -1], None), ([127, 127, 12], 1200), ([0, 0, 12], -1200), ([64, 100, 2], 114)], [([0, 56, 1], -13), ([0, 24, 1], -63), ([0, 0, 12], -1200), ([64, 100, 2], 114), ([0, 88, 1], 38), ([127, 127, 48], 4800), ([0, 0, 48], -4800), ([100, 127, 48], 4784)]]\nfor i, (args, expected) in enumerate(fixtures[N-1]):\n    check(\"oracle %d\" % i, solve(args), expected)\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":"546e8c4efb19cf092da35eacf84137da782134d12412489f9a78a9016a899668","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(x):\n    if not isinstance(x, list) or len(x) != 3:\n        return None\n    lsb, msb, rng = x\n    if not all(isinstance(v, int) and 0 <= v <= 127 for v in (lsb, msb)) or rng < 0:\n        return None\n    value = (msb << 7) | lsb\n    offset = value - 8192\n    den = 8191 if offset > 0 else 8192\n    c = Fraction(abs(offset) * rng * 100, den)\n    cents = int(c)\n    return cents if offset >= 0 else -cents\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[([0, 64, 2], 0), ([127, 127, 2], 200), ([0, 0, 2], -200), ([0, 96, 2], 100), ([0, 32, 2], -100), ([0, 56, 1], -13), ([0, 24, 1], -63), ([0, 40, 1], -38)], [([0, 96, 2], 100), ([0, 32, 2], -100), ([0, 56, 1], -13), ([0, 24, 1], -63), ([1, 64, 2], 0), ([127, 63, 2], 0), ([0, 72, 12], 150), ([0, 56, 3], -38)], [([0, 56, 1], -13), ([0, 24, 1], -63), ([0, 40, 1], -38), ([127, 63, 2], 0), ([0, 72, 12], 150), ([0, 128, 2], None), ([128, 64, 2], None), ([0, 88, 1], 38)], [([0, 56, 1], -13), ([0, 24, 1], -63), ([0, 56, 3], -38), ([128, 64, 2], None), ([0, 64, -1], None), ([127, 127, 12], 1200), ([0, 0, 12], -1200), ([64, 100, 2], 114)], [([0, 56, 1], -13), ([0, 24, 1], -63), ([0, 0, 12], -1200), ([64, 100, 2], 114), ([0, 88, 1], 38), ([127, 127, 48], 4800), ([0, 0, 48], -4800), ([100, 127, 48], 4784)]]\nfor i, (args, expected) in enumerate(fixtures[N-1]):\n    check(\"oracle %d\" % i, solve(args), expected)\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":"A deterministic bounded teaching model with a stipulated toy contract; it is not a complete Standard MIDI File or MIDI 1.0/2.0 implementation. 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":"w2-midi-event-timing-pitch-bend-cents-cent-rounding","generated_at":"2026-09-29T14:50:05.037643+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"MIDI sequencers, file readers and synth drivers depend on exact event ordering and tick/time arithmetic.","root_cause":"The scaled magnitude is truncated instead of rounded half away from zero.","sha256":"8fa4f09ecad062ff2a89d3c1b9822cd494f8c725e3be4cf684460221537729d8","title":"14-bit pitch bend to cents: cents truncated · 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":39.719,"exit_code":1,"observations":[{"actual":0,"check":"oracle 0","expected":0,"passed":true},{"actual":200,"check":"oracle 1","expected":200,"passed":true},{"actual":-200,"check":"oracle 2","expected":-200,"passed":true},{"actual":100,"check":"oracle 3","expected":100,"passed":true},{"actual":-100,"check":"oracle 4","expected":-100,"passed":true},{"actual":-12,"check":"oracle 5","expected":-13,"passed":false},{"actual":-62,"check":"oracle 6","expected":-63,"passed":false},{"actual":-38,"check":"oracle 7","expected":-38,"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"oracle 0\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"oracle 1\", \"actual\": 200, \"expected\": 200, \"passed\": true}, {\"check\": \"oracle 2\", \"actual\": -200, \"expected\": -200, \"passed\": true}, {\"check\": \"oracle 3\", \"actual\": 100, \"expected\": 100, \"passed\": true}, {\"check\": \"oracle 4\", \"actual\": -100, \"expected\": -100, \"passed\": true}, {\"check\": \"oracle 5\", \"actual\": -12, \"expected\": -13, \"passed\": false}, {\"check\": \"oracle 6\", \"actual\": -62, \"expected\": -63, \"passed\": false}, {\"check\": \"oracle 7\", \"actual\": -38, \"expected\": -38, \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":42.43,"exit_code":1,"observations":[{"actual":0,"check":"oracle 0","expected":0,"passed":true},{"actual":200,"check":"oracle 1","expected":200,"passed":true},{"actual":-200,"check":"oracle 2","expected":-200,"passed":true},{"actual":100,"check":"oracle 3","expected":100,"passed":true},{"actual":-100,"check":"oracle 4","expected":-100,"passed":true},{"actual":-12,"check":"oracle 5","expected":-13,"passed":false},{"actual":-62,"check":"oracle 6","expected":-63,"passed":false},{"actual":-37,"check":"oracle 7","expected":-38,"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"oracle 0\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"oracle 1\", \"actual\": 200, \"expected\": 200, \"passed\": true}, {\"check\": \"oracle 2\", \"actual\": -200, \"expected\": -200, \"passed\": true}, {\"check\": \"oracle 3\", \"actual\": 100, \"expected\": 100, \"passed\": true}, {\"check\": \"oracle 4\", \"actual\": -100, \"expected\": -100, \"passed\": true}, {\"check\": \"oracle 5\", \"actual\": -12, \"expected\": -13, \"passed\": false}, {\"check\": \"oracle 6\", \"actual\": -62, \"expected\": -63, \"passed\": false}, {\"check\": \"oracle 7\", \"actual\": -37, \"expected\": -38, \"passed\": false}], \"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."}}