FAILURE MAP
← Case archive

FA-16621 / Floating-point arithmetic / Open access

Exact ratio conversion scales subnormals as normal mantissas · case 01

Exact ratio conversion scales subnormals as normal mantissas.

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

ROOT CAUSE

Exact ratio conversion scales subnormals as normal mantissas. The faulty expression is power=-1022.

THE FAILURE

Exact ratio conversion scales subnormals as normal mantissas. The faulty expression is power=-1022.

Unsuccessful approach: The attempted local correction power=-1075 still violates the explicit regression fixtures.

Case contract

Decode a finite binary64 value into its exact reduced signed numerator and positive power-of-two denominator, using (0,1) for either zero. Infinity and NaN return null.

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(bits):
    sign=-1 if bits>>63 else 1
    e=(bits>>52)&2047
    f=bits&((1<<52)-1)
    if e==2047: return None
    if e:
        mantissa=f|(1<<52)
        power=e-1023-52
    else:
        mantissa=f
        power=-1022
    if mantissa==0: return [0,1]
    while power<0 and mantissa%2==0:
        mantissa//=2
        power+=1
    if power>=0: return [sign*(mantissa<<power),1]
    return [sign*mantissa,1<<(-power)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('large integer', solve((1023+60+N)<<52), [1<<(60+N),1])
check('positive integer', solve((1023+N)<<52), [1<<N,1])
check('negative integer', solve((1<<63)|((1023+N)<<52)), [-(1<<N),1])
check('fraction', solve(0x3fe0000000000000), [1,2])
check('nontrivial fraction', solve(0x3fe8000000000000), [3,4])
check('minimum subnormal', solve(N), list(math.ldexp(float(N),-1074).as_integer_ratio()))
check('negative subnormal', solve((1<<63)|N), list((-math.ldexp(float(N),-1074)).as_integer_ratio()))
check('zero', solve(0), [0,1])
check('negative zero', solve(1<<63), [0,1])
check('infinity', solve(0x7ff0000000000000), None)
check('nan', solve(0x7ff8000000000000|N), None)
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
large integer[2305843009213693952, 1][2305843009213693952, 1]Passed
positive integer[2, 1][2, 1]Passed
negative integer[-2, 1][-2, 1]Passed
fraction[1, 2][1, 2]Passed
nontrivial fraction[3, 4][3, 4]Passed
minimum subnormal[1, 44942328371557897693232629769725618340449424473557664318357520289433168951375240783177119330601884005280028469967848339414697442203604155623211857659868531094441973356216371319075554900311523529863270738021251442209537670585615720368478277635206809290837627671146574559986811484619929076208839082406056034304][1, 202402253307310618352495346718917307049556649764142118356901358027430339567995346891960383701437124495187077864316811911389808737385793476867013399940738509921517424276566361364466907742093216341239767678472745068562007483424692698618103355649159556340810056512358769552333414615230502532186327508646006263307707741093494784]Failed
negative subnormal[-1, 44942328371557897693232629769725618340449424473557664318357520289433168951375240783177119330601884005280028469967848339414697442203604155623211857659868531094441973356216371319075554900311523529863270738021251442209537670585615720368478277635206809290837627671146574559986811484619929076208839082406056034304][-1, 202402253307310618352495346718917307049556649764142118356901358027430339567995346891960383701437124495187077864316811911389808737385793476867013399940738509921517424276566361364466907742093216341239767678472745068562007483424692698618103355649159556340810056512358769552333414615230502532186327508646006263307707741093494784]Failed
zero[0, 1][0, 1]Passed
negative zero[0, 1][0, 1]Passed
infinityNoneNonePassed
nanNoneNonePassed

SHA-256 / dd4cd76d3a296ee2a8b576d0665b4c2c341c619bf9129d0f4bcb60c082b8ec7f

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(bits):
    sign=-1 if bits>>63 else 1
    e=(bits>>52)&2047
    f=bits&((1<<52)-1)
    if e==2047: return None
    if e:
        mantissa=f|(1<<52)
        power=e-1023-52
    else:
        mantissa=f
        power=-1075
    if mantissa==0: return [0,1]
    while power<0 and mantissa%2==0:
        mantissa//=2
        power+=1
    if power>=0: return [sign*(mantissa<<power),1]
    return [sign*mantissa,1<<(-power)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('large integer', solve((1023+60+N)<<52), [1<<(60+N),1])
check('positive integer', solve((1023+N)<<52), [1<<N,1])
check('negative integer', solve((1<<63)|((1023+N)<<52)), [-(1<<N),1])
check('fraction', solve(0x3fe0000000000000), [1,2])
check('nontrivial fraction', solve(0x3fe8000000000000), [3,4])
check('minimum subnormal', solve(N), list(math.ldexp(float(N),-1074).as_integer_ratio()))
check('negative subnormal', solve((1<<63)|N), list((-math.ldexp(float(N),-1074)).as_integer_ratio()))
check('zero', solve(0), [0,1])
check('negative zero', solve(1<<63), [0,1])
check('infinity', solve(0x7ff0000000000000), None)
check('nan', solve(0x7ff8000000000000|N), None)
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
large integer[2305843009213693952, 1][2305843009213693952, 1]Passed
positive integer[2, 1][2, 1]Passed
negative integer[-2, 1][-2, 1]Passed
fraction[1, 2][1, 2]Passed
nontrivial fraction[3, 4][3, 4]Passed
minimum subnormal[1, 404804506614621236704990693437834614099113299528284236713802716054860679135990693783920767402874248990374155728633623822779617474771586953734026799881477019843034848553132722728933815484186432682479535356945490137124014966849385397236206711298319112681620113024717539104666829230461005064372655017292012526615415482186989568][1, 202402253307310618352495346718917307049556649764142118356901358027430339567995346891960383701437124495187077864316811911389808737385793476867013399940738509921517424276566361364466907742093216341239767678472745068562007483424692698618103355649159556340810056512358769552333414615230502532186327508646006263307707741093494784]Failed
negative subnormal[-1, 404804506614621236704990693437834614099113299528284236713802716054860679135990693783920767402874248990374155728633623822779617474771586953734026799881477019843034848553132722728933815484186432682479535356945490137124014966849385397236206711298319112681620113024717539104666829230461005064372655017292012526615415482186989568][-1, 202402253307310618352495346718917307049556649764142118356901358027430339567995346891960383701437124495187077864316811911389808737385793476867013399940738509921517424276566361364466907742093216341239767678472745068562007483424692698618103355649159556340810056512358769552333414615230502532186327508646006263307707741093494784]Failed
zero[0, 1][0, 1]Passed
negative zero[0, 1][0, 1]Passed
infinityNoneNonePassed
nanNoneNonePassed

SHA-256 / f7aa3c7f30782606169bbbb004653012695798c12c6b4f9229c5ab55575db43c

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 11 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

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:38.341867+00:00.

Case digest / 2d97a00b85d08c4b505b748fbfe347b61841f8539af367ebfd1f27e240dd260e