FAILURE MAP
← Case archive

FA-16036 / Floating-point arithmetic / Open access

The encoded fraction retains its implicit leading one · case 01

The encoded fraction retains its implicit leading one.

Verified by executionVariant 1 · 14 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The encoded fraction retains its implicit leading one. The faulty expression is fraction=q.

VERIFIED REPAIR

Apply the contract at this fault site using fraction=q-8.

Unsuccessful approach: The attempted local correction fraction=q%7 still violates the explicit regression fixtures.

Case contract

Encode finite exactly represented dyadic x into sign/4-bit-exponent/3-bit-fraction toy float with bias 7, gradual underflow, round-to-nearest-even and infinity overflow. Return the unsigned byte. The miniature format is stipulated, not a hardware conformance claim.

Why this case matters

An offline floating representation model isolates a reproducible arithmetic fault.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import struct
N = 1
observations = []
def solve(x):
    sign=128 if math.copysign(1.0,x)<0 else 0
    x=abs(x)
    if x == 0: return sign
    if x >= 248: return sign|120
    if x < 2**-6:
        q=round(x*512)
        return sign|q
    m,e=math.frexp(x)
    e-=1
    q=round(m*16)
    if q == 16:
        q=8
        e+=1
    if e>7: return sign|120
    exponent=e+7
    fraction=q
    return sign|(exponent<<3)|fraction
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('zero', solve(0.0), 0)
check('negative zero', solve(-0.0), 128)
check('subnormal', solve(N/512), N)
check('negative subnormal', solve(-N/512), 128|N)
check('underflow tie', solve(1/1024), 0)
check('subnormal carry', solve(15/1024), 8)
check('normal varying', solve(2.0**N), (N+7)<<3)
check('normal fraction', solve((8+N)/8), 56+N)
check('binade carry', solve(1.9375), 64)
check('below midpoint', solve(1.90625), 63)
check('largest finite', solve(240.0), 119)
check('overflow tie', solve(248.0), 120)
check('negative overflow', solve(-256.0), 248)
check('minimum normal', solve(1/64), 8)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
zero00Passed
negative zero128128Passed
subnormal11Passed
negative subnormal129129Passed
underflow tie00Passed
subnormal carry88Passed
normal varying7264Failed
normal fraction5757Passed
binade carry7264Failed
below midpoint6363Passed
largest finite127119Failed
overflow tie120120Passed
negative overflow248248Passed
minimum normal88Passed

SHA-256 / 3543fa7962d2f19efc81cb2ac1d3cbbc5dc84c8273ad90bf6cafd6c504b2ff3c

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import struct
N = 1
observations = []
def solve(x):
    sign=128 if math.copysign(1.0,x)<0 else 0
    x=abs(x)
    if x == 0: return sign
    if x >= 248: return sign|120
    if x < 2**-6:
        q=round(x*512)
        return sign|q
    m,e=math.frexp(x)
    e-=1
    q=round(m*16)
    if q == 16:
        q=8
        e+=1
    if e>7: return sign|120
    exponent=e+7
    fraction=q%7
    return sign|(exponent<<3)|fraction
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('zero', solve(0.0), 0)
check('negative zero', solve(-0.0), 128)
check('subnormal', solve(N/512), N)
check('negative subnormal', solve(-N/512), 128|N)
check('underflow tie', solve(1/1024), 0)
check('subnormal carry', solve(15/1024), 8)
check('normal varying', solve(2.0**N), (N+7)<<3)
check('normal fraction', solve((8+N)/8), 56+N)
check('binade carry', solve(1.9375), 64)
check('below midpoint', solve(1.90625), 63)
check('largest finite', solve(240.0), 119)
check('overflow tie', solve(248.0), 120)
check('negative overflow', solve(-256.0), 248)
check('minimum normal', solve(1/64), 8)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
zero00Passed
negative zero128128Passed
subnormal11Passed
negative subnormal129129Passed
underflow tie00Passed
subnormal carry88Passed
normal varying6564Failed
normal fraction5857Failed
binade carry6564Failed
below midpoint5763Failed
largest finite113119Failed
overflow tie120120Passed
negative overflow248248Passed
minimum normal98Failed

SHA-256 / 4da0e41b856d73f8af5974eaa797eeb955e371cf37e7415652c306c55507e8ea

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import struct
N = 1
observations = []
def solve(x):
    sign=128 if math.copysign(1.0,x)<0 else 0
    x=abs(x)
    if x == 0: return sign
    if x >= 248: return sign|120
    if x < 2**-6:
        q=round(x*512)
        return sign|q
    m,e=math.frexp(x)
    e-=1
    q=round(m*16)
    if q == 16:
        q=8
        e+=1
    if e>7: return sign|120
    exponent=e+7
    fraction=q-8
    return sign|(exponent<<3)|fraction
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('zero', solve(0.0), 0)
check('negative zero', solve(-0.0), 128)
check('subnormal', solve(N/512), N)
check('negative subnormal', solve(-N/512), 128|N)
check('underflow tie', solve(1/1024), 0)
check('subnormal carry', solve(15/1024), 8)
check('normal varying', solve(2.0**N), (N+7)<<3)
check('normal fraction', solve((8+N)/8), 56+N)
check('binade carry', solve(1.9375), 64)
check('below midpoint', solve(1.90625), 63)
check('largest finite', solve(240.0), 119)
check('overflow tie', solve(248.0), 120)
check('negative overflow', solve(-256.0), 248)
check('minimum normal', solve(1/64), 8)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
zero00Passed
negative zero128128Passed
subnormal11Passed
negative subnormal129129Passed
underflow tie00Passed
subnormal carry88Passed
normal varying6464Passed
normal fraction5757Passed
binade carry6464Passed
below midpoint6363Passed
largest finite119119Passed
overflow tie120120Passed
negative overflow248248Passed
minimum normal88Passed

SHA-256 / a4885c1da227084f5313862887aa4cd62946fb499325336c2d369be5452b6fec

Verification & scope

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.

Observations recorded using Python 3.12.14 at 2026-09-29T14:39:32.695315+00:00.

Case digest / b8bce4800b3a3ccab4fb7d35fb9e772fcde119aef931296b78ad9c85bf175fcd