{"abstract":"Scans at 333 1/3 dpi or 72.00 stored as 7200/100 get slightly wrong printed widths.","category":"Image orientation metadata","checks":8,"contract":"Input {w, h, tag?, unit?, xres: [num, den], yres?: [num, den]}. ResolutionUnit 2 is inches (25.4 mm), 3 is centimetres (10 mm), a missing unit defaults to 2 and any other unit has no physical size (None). A missing yres equals xres; non-positive rational parts give None. For tags 5..8 the displayed width comes from the stored height at YResolution. Return displayed [width, height] in tenths of a millimetre, each rounded half up from the exact value.","contract_signature":"d","evaluation_group":"w2-image-orientation-metadata-print-physical-size","failed_approach":"Rounding the float quotient still discards the fractional part.","family":"w2-image-orientation-metadata-print-physical-size-rational-resolution","id":"FA-79221","implementations":{"attempt":{"sha256":"ec561fca5a7fda9e5c76c82703f47e8eb5e7007f7a71dfe1ce8ff3402854825b","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(d):\n    w, h = d['w'], d['h']\n    tag = d.get('tag', 1)\n    unit = d.get('unit', 2)\n    per = {2: Fraction(254, 10), 3: Fraction(10)}.get(unit)\n    if per is None:\n        return None\n    xn, xd = d['xres']\n    yn, yd = d.get('yres', d['xres'])\n    if xn <= 0 or xd <= 0 or yn <= 0 or yd <= 0:\n        return None\n    xr = Fraction(round(xn / xd))\n    yr = Fraction(yn, yd)\n    if tag in (5, 6, 7, 8):\n        w, h, xr, yr = h, w, yr, xr\n    def tenths(px, r):\n        return math.floor(px * per * 10 / r + Fraction(1, 2))\n    return [tenths(w, xr), tenths(h, yr)]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[[{'w': 1315, 'h': 446, 'tag': 6, 'unit': 2, 'xres': [1000, 3], 'yres': [1000, 3]}, [340, 1002]], [{'w': 878, 'h': 2270, 'tag': 2, 'unit': 2, 'xres': [200, 3], 'yres': [1000, 3]}, [3345, 1730]], [{'w': 2250, 'h': 3721, 'tag': 6, 'xres': [300, 1]}, [3150, 1905]], [{'w': 2577, 'h': 2775, 'tag': 6, 'xres': [0, 1]}, None], [{'w': 3942, 'h': 988, 'tag': 8, 'unit': 3, 'xres': [72, 1]}, [1372, 5475]], [{'w': 2676, 'h': 1814, 'tag': 6, 'unit': 3, 'xres': [300, 1], 'yres': [600, 1]}, [302, 892]], [{'w': 2042, 'h': 678, 'unit': 3, 'xres': [150, 2]}, [2723, 904]], [{'w': 52, 'h': 2736, 'unit': 3, 'xres': [200, 3], 'yres': [40, 1]}, [78, 6840]]], [[{'w': 3188, 'h': 3159, 'tag': 1, 'unit': 2, 'xres': [1000, 3]}, [2429, 2407]], [{'w': 3677, 'h': 3545, 'tag': 6, 'unit': 3, 'xres': [1000, 3], 'yres': [40, 1]}, [8863, 1103]], [{'w': 1360, 'h': 1067, 'tag': 7, 'xres': [300, 1]}, [903, 1151]], [{'w': 553, 'h': 1044, 'tag': 8, 'unit': 2, 'xres': [200, 3], 'yres': [-300, 1]}, None], [{'w': 1140, 'h': 2204, 'tag': 5, 'unit': 3, 'xres': [40, 1], 'yres': [96, 1]}, [2296, 2850]], [{'w': 3266, 'h': 1419, 'tag': 5, 'unit': 3, 'xres': [300, 1], 'yres': [1000, 3]}, [426, 1089]], [{'w': 3380, 'h': 2534, 'tag': 6, 'xres': [300, 1]}, [2145, 2862]], [{'w': 2836, 'h': 866, 'tag': 2, 'unit': 3, 'xres': [1000, 3], 'yres': [40, 1]}, [851, 2165]]], [[{'w': 1597, 'h': 265, 'tag': 2, 'unit': 2, 'xres': [1000, 3], 'yres': [40, 1]}, [1217, 1683]], [{'w': 534, 'h': 3368, 'tag': 8, 'unit': 3, 'xres': [200, 3], 'yres': [96, 1]}, [3508, 801]], [{'w': 2503, 'h': 3897, 'tag': 6, 'unit': 1, 'xres': [200, 3], 'yres': [72, 1]}, None], [{'w': 2, 'h': 3716, 'unit': 2, 'xres': [300, 1]}, [2, 3146]], [{'w': 724, 'h': 1179, 'unit': 2, 'xres': [40, 1], 'yres': [-300, 1]}, None], [{'w': 3823, 'h': 2286, 'tag': 8, 'unit': 3, 'xres': [150, 2], 'yres': [1000, 3]}, [686, 5097]], [{'w': 2151, 'h': 2111, 'tag': 5, 'unit': 2, 'xres': [7200, 100]}, [7447, 7588]], [{'w': 1921, 'h': 398, 'tag': 6, 'unit': 2, 'xres': [200, 3], 'yres': [600, 1]}, [168, 7319]]], [[{'w': 933, 'h': 2633, 'tag': 3, 'unit': 2, 'xres': [1000, 3], 'yres': [600, 1]}, [711, 1115]], [{'w': 3732, 'h': 2959, 'tag': 3, 'unit': 2, 'xres': [1000, 3], 'yres': [40, 1]}, [2844, 18790]], [{'w': 1, 'h': 3356, 'tag': 7, 'xres': [-72, 1], 'yres': [96, 1]}, None], [{'w': 776, 'h': 1736, 'tag': 1, 'unit': 3, 'xres': [96, 1]}, [808, 1808]], [{'w': 3732, 'h': 1632, 'tag': 6, 'unit': 3, 'xres': [150, 2], 'yres': [72, 1]}, [2267, 4976]], [{'w': 2768, 'h': 3254, 'tag': 1, 'unit': 3, 'xres': [300, 1]}, [923, 1085]], [{'w': 1975, 'h': 3847, 'tag': 8, 'unit': 2, 'xres': [72, 1], 'yres': [40, 1]}, [24428, 6967]], [{'w': 1216, 'h': 3589, 'tag': 7, 'unit': 2, 'xres': [1000, 3], 'yres': [72, 1]}, [12661, 927]]], [[{'w': 1800, 'h': 1611, 'tag': 6, 'xres': [1000, 3]}, [1228, 1372]], [{'w': 3676, 'h': 1244, 'tag': 6, 'unit': 2, 'xres': [200, 3], 'yres': [72, 1]}, [4389, 14006]], [{'w': 2880, 'h': 3333, 'tag': 1, 'xres': [200, 3], 'yres': [-300, 1]}, None], [{'w': 3908, 'h': 2121, 'tag': 6, 'unit': 1, 'xres': [96, 1], 'yres': [40, 1]}, None], [{'w': 2271, 'h': 2906, 'tag': 1, 'unit': 3, 'xres': [72, 1]}, [3154, 4036]], [{'w': 3285, 'h': 917, 'tag': 3, 'unit': 3, 'xres': [300, 1], 'yres': [72, 1]}, [1095, 1274]], [{'w': 690, 'h': 269, 'xres': [40, 1], 'yres': [72, 1]}, [4382, 949]], [{'w': 3185, 'h': 889, 'tag': 8, 'unit': 2, 'xres': [1000, 3], 'yres': [96, 1]}, [2352, 2427]]]]\nlabels = [\"regression: rational resolution precision\", \"repair trap\", \"combined fault\", \"control\", \"control\", \"boundary\", \"boundary\", \"control\"]\nfor i, (args, expected) in enumerate(fixtures[N-1]):\n    check(\"%s %d\" % (labels[i % len(labels)], 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":"a567c37bbd5fe5bcaa40ed0c8ebeb10f5b8455ee5fd2fd5cd10e46fc12fc57c1","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(d):\n    w, h = d['w'], d['h']\n    tag = d.get('tag', 1)\n    unit = d.get('unit', 2)\n    per = {2: Fraction(254, 10), 3: Fraction(10)}.get(unit)\n    if per is None:\n        return None\n    xn, xd = d['xres']\n    yn, yd = d.get('yres', d['xres'])\n    if xn <= 0 or xd <= 0 or yn <= 0 or yd <= 0:\n        return None\n    xr = Fraction(xn // xd)\n    yr = Fraction(yn, yd)\n    if tag in (5, 6, 7, 8):\n        w, h, xr, yr = h, w, yr, xr\n    def tenths(px, r):\n        return math.floor(px * per * 10 / r + Fraction(1, 2))\n    return [tenths(w, xr), tenths(h, yr)]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[[{'w': 1315, 'h': 446, 'tag': 6, 'unit': 2, 'xres': [1000, 3], 'yres': [1000, 3]}, [340, 1002]], [{'w': 878, 'h': 2270, 'tag': 2, 'unit': 2, 'xres': [200, 3], 'yres': [1000, 3]}, [3345, 1730]], [{'w': 2250, 'h': 3721, 'tag': 6, 'xres': [300, 1]}, [3150, 1905]], [{'w': 2577, 'h': 2775, 'tag': 6, 'xres': [0, 1]}, None], [{'w': 3942, 'h': 988, 'tag': 8, 'unit': 3, 'xres': [72, 1]}, [1372, 5475]], [{'w': 2676, 'h': 1814, 'tag': 6, 'unit': 3, 'xres': [300, 1], 'yres': [600, 1]}, [302, 892]], [{'w': 2042, 'h': 678, 'unit': 3, 'xres': [150, 2]}, [2723, 904]], [{'w': 52, 'h': 2736, 'unit': 3, 'xres': [200, 3], 'yres': [40, 1]}, [78, 6840]]], [[{'w': 3188, 'h': 3159, 'tag': 1, 'unit': 2, 'xres': [1000, 3]}, [2429, 2407]], [{'w': 3677, 'h': 3545, 'tag': 6, 'unit': 3, 'xres': [1000, 3], 'yres': [40, 1]}, [8863, 1103]], [{'w': 1360, 'h': 1067, 'tag': 7, 'xres': [300, 1]}, [903, 1151]], [{'w': 553, 'h': 1044, 'tag': 8, 'unit': 2, 'xres': [200, 3], 'yres': [-300, 1]}, None], [{'w': 1140, 'h': 2204, 'tag': 5, 'unit': 3, 'xres': [40, 1], 'yres': [96, 1]}, [2296, 2850]], [{'w': 3266, 'h': 1419, 'tag': 5, 'unit': 3, 'xres': [300, 1], 'yres': [1000, 3]}, [426, 1089]], [{'w': 3380, 'h': 2534, 'tag': 6, 'xres': [300, 1]}, [2145, 2862]], [{'w': 2836, 'h': 866, 'tag': 2, 'unit': 3, 'xres': [1000, 3], 'yres': [40, 1]}, [851, 2165]]], [[{'w': 1597, 'h': 265, 'tag': 2, 'unit': 2, 'xres': [1000, 3], 'yres': [40, 1]}, [1217, 1683]], [{'w': 534, 'h': 3368, 'tag': 8, 'unit': 3, 'xres': [200, 3], 'yres': [96, 1]}, [3508, 801]], [{'w': 2503, 'h': 3897, 'tag': 6, 'unit': 1, 'xres': [200, 3], 'yres': [72, 1]}, None], [{'w': 2, 'h': 3716, 'unit': 2, 'xres': [300, 1]}, [2, 3146]], [{'w': 724, 'h': 1179, 'unit': 2, 'xres': [40, 1], 'yres': [-300, 1]}, None], [{'w': 3823, 'h': 2286, 'tag': 8, 'unit': 3, 'xres': [150, 2], 'yres': [1000, 3]}, [686, 5097]], [{'w': 2151, 'h': 2111, 'tag': 5, 'unit': 2, 'xres': [7200, 100]}, [7447, 7588]], [{'w': 1921, 'h': 398, 'tag': 6, 'unit': 2, 'xres': [200, 3], 'yres': [600, 1]}, [168, 7319]]], [[{'w': 933, 'h': 2633, 'tag': 3, 'unit': 2, 'xres': [1000, 3], 'yres': [600, 1]}, [711, 1115]], [{'w': 3732, 'h': 2959, 'tag': 3, 'unit': 2, 'xres': [1000, 3], 'yres': [40, 1]}, [2844, 18790]], [{'w': 1, 'h': 3356, 'tag': 7, 'xres': [-72, 1], 'yres': [96, 1]}, None], [{'w': 776, 'h': 1736, 'tag': 1, 'unit': 3, 'xres': [96, 1]}, [808, 1808]], [{'w': 3732, 'h': 1632, 'tag': 6, 'unit': 3, 'xres': [150, 2], 'yres': [72, 1]}, [2267, 4976]], [{'w': 2768, 'h': 3254, 'tag': 1, 'unit': 3, 'xres': [300, 1]}, [923, 1085]], [{'w': 1975, 'h': 3847, 'tag': 8, 'unit': 2, 'xres': [72, 1], 'yres': [40, 1]}, [24428, 6967]], [{'w': 1216, 'h': 3589, 'tag': 7, 'unit': 2, 'xres': [1000, 3], 'yres': [72, 1]}, [12661, 927]]], [[{'w': 1800, 'h': 1611, 'tag': 6, 'xres': [1000, 3]}, [1228, 1372]], [{'w': 3676, 'h': 1244, 'tag': 6, 'unit': 2, 'xres': [200, 3], 'yres': [72, 1]}, [4389, 14006]], [{'w': 2880, 'h': 3333, 'tag': 1, 'xres': [200, 3], 'yres': [-300, 1]}, None], [{'w': 3908, 'h': 2121, 'tag': 6, 'unit': 1, 'xres': [96, 1], 'yres': [40, 1]}, None], [{'w': 2271, 'h': 2906, 'tag': 1, 'unit': 3, 'xres': [72, 1]}, [3154, 4036]], [{'w': 3285, 'h': 917, 'tag': 3, 'unit': 3, 'xres': [300, 1], 'yres': [72, 1]}, [1095, 1274]], [{'w': 690, 'h': 269, 'xres': [40, 1], 'yres': [72, 1]}, [4382, 949]], [{'w': 3185, 'h': 889, 'tag': 8, 'unit': 2, 'xres': [1000, 3], 'yres': [96, 1]}, [2352, 2427]]]]\nlabels = [\"regression: rational resolution precision\", \"repair trap\", \"combined fault\", \"control\", \"control\", \"boundary\", \"boundary\", \"control\"]\nfor i, (args, expected) in enumerate(fixtures[N-1]):\n    check(\"%s %d\" % (labels[i % len(labels)], 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 contract; it makes no claim of conformance to any published specification. 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-image-orientation-metadata-print-physical-size-rational-resolution","generated_at":"2026-09-29T14:49:42.488876+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Camera, phone and scanner images carry an orientation hint separately from the stored pixels; galleries, thumbnailers, editors and upload pipelines must interpret it consistently or photos appear sideways, mirrored or doubly rotated.","root_cause":"The rational XResolution is integer-divided before use.","sha256":"665c132918600d3fcf82676c142ca746674c7d8f469c0cdb0abfd00e7405246c","title":"Fractional X resolution is truncated to an integer · 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":42.695,"exit_code":1,"observations":[{"actual":[340,1003],"check":"regression: rational resolution precision 0","expected":[340,1002],"passed":false},{"actual":[3329,1730],"check":"repair trap 1","expected":[3345,1730],"passed":false},{"actual":[3150,1905],"check":"combined fault 2","expected":[3150,1905],"passed":true},{"actual":null,"check":"control 3","expected":null,"passed":true},{"actual":[1372,5475],"check":"control 4","expected":[1372,5475],"passed":true},{"actual":[302,892],"check":"boundary 5","expected":[302,892],"passed":true},{"actual":[2723,904],"check":"boundary 6","expected":[2723,904],"passed":true},{"actual":[78,6840],"check":"control 7","expected":[78,6840],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: rational resolution precision 0\", \"actual\": [340, 1003], \"expected\": [340, 1002], \"passed\": false}, {\"check\": \"repair trap 1\", \"actual\": [3329, 1730], \"expected\": [3345, 1730], \"passed\": false}, {\"check\": \"combined fault 2\", \"actual\": [3150, 1905], \"expected\": [3150, 1905], \"passed\": true}, {\"check\": \"control 3\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"control 4\", \"actual\": [1372, 5475], \"expected\": [1372, 5475], \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": [302, 892], \"expected\": [302, 892], \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": [2723, 904], \"expected\": [2723, 904], \"passed\": true}, {\"check\": \"control 7\", \"actual\": [78, 6840], \"expected\": [78, 6840], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":42.864,"exit_code":1,"observations":[{"actual":[340,1003],"check":"regression: rational resolution precision 0","expected":[340,1002],"passed":false},{"actual":[3379,1730],"check":"repair trap 1","expected":[3345,1730],"passed":false},{"actual":[3150,1905],"check":"combined fault 2","expected":[3150,1905],"passed":true},{"actual":null,"check":"control 3","expected":null,"passed":true},{"actual":[1372,5475],"check":"control 4","expected":[1372,5475],"passed":true},{"actual":[302,892],"check":"boundary 5","expected":[302,892],"passed":true},{"actual":[2723,904],"check":"boundary 6","expected":[2723,904],"passed":true},{"actual":[79,6840],"check":"control 7","expected":[78,6840],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: rational resolution precision 0\", \"actual\": [340, 1003], \"expected\": [340, 1002], \"passed\": false}, {\"check\": \"repair trap 1\", \"actual\": [3379, 1730], \"expected\": [3345, 1730], \"passed\": false}, {\"check\": \"combined fault 2\", \"actual\": [3150, 1905], \"expected\": [3150, 1905], \"passed\": true}, {\"check\": \"control 3\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"control 4\", \"actual\": [1372, 5475], \"expected\": [1372, 5475], \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": [302, 892], \"expected\": [302, 892], \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": [2723, 904], \"expected\": [2723, 904], \"passed\": true}, {\"check\": \"control 7\", \"actual\": [79, 6840], \"expected\": [78, 6840], \"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."}}