FAILURE MAP
← Case archive

FA-66576 / Airline fare rule evaluation / Open access

Unit ceiling computed in binary floating point · case 01

A 100.00 NUC fare at ROE 1.1 is collected as 111 instead of 110.

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

ROOT CAUSE

The conversion multiplies in binary floats, so 100.0 * 1.1 = 110.00000000000001 and the ceiling adds a whole unit.

VERIFIED REPAIR

Round up in exact decimal arithmetic.

Unsuccessful approach: Adding one half and rounding bumps exact amounts to the next unit.

Case contract

Input {'nuc':[component amounts],'roe','currency'}. Sum components exactly, truncate the NUC total to 2 decimals, multiply by ROE, and round UP to the currency unit (USD/EUR/GBP 1, JPY 100, KWD 0.1) in exact decimal arithmetic; other currencies -> 'ERR_CURRENCY'. Return [NUC string, local string].

Why this case matters

Fare construction sums neutral units, converts with a rate of exchange, and rounds to currency-specific units in a prescribed direction.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import decimal
import math
N = 1
observations = []
def solve(x):
    units = {'USD': '1', 'EUR': '1', 'JPY': '100', 'KWD': '0.1', 'GBP': '1'}
    cur = x['currency']
    if cur not in units: return 'ERR_CURRENCY'
    nuc = sum(decimal.Decimal(str(c)) for c in x['nuc'])
    nuc = nuc.quantize(decimal.Decimal('0.01'), rounding=decimal.ROUND_DOWN)
    local = nuc * decimal.Decimal(str(x['roe']))
    u = decimal.Decimal(units[cur])
    local = decimal.Decimal(math.ceil(float(nuc) * x['roe'] / float(u))) * u
    return [str(nuc), str(local)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['USD two components', {'nuc': [412.357, 388.25], 'roe': 1.0, 'currency': 'USD'}, ['800.60', '801']], ['JPY hundreds', {'nuc': [512.12, 97.555], 'roe': 148.336, 'currency': 'JPY'}, ['609.67', '90500']], ['KWD tenths', {'nuc': [700.009, 100.0], 'roe': 0.30712, 'currency': 'KWD'}, ['800.00', '245.7']], ['exact local amount', {'nuc': [250.0, 250.0], 'roe': 0.92, 'currency': 'EUR'}, ['500.00', '460']], ['float product trap', {'nuc': [100.0], 'roe': 1.1, 'currency': 'USD'}, ['100.00', '110']], ['unsupported currency', {'nuc': [100.0], 'roe': 3.67, 'currency': 'AED'}, 'ERR_CURRENCY'], ['sum crosses a cent', {'nuc': [100.005, 200.006], 'roe': 0.788341, 'currency': 'GBP'}, ['300.01', '237']], ['sampled case 1', {'nuc': [803.18, 217.556], 'roe': 82.0232, 'currency': 'EUR'}, ['1020.73', '83724']], ['sampled case 2', {'nuc': [103.64], 'roe': 139.908192, 'currency': 'JPY'}, ['103.64', '14600']], ['sampled case 3', {'nuc': [310.5398, 792.913, 638.67], 'roe': 101.8, 'currency': 'EUR'}, ['1742.12', '177348']]], [['USD two components', {'nuc': [412.357, 388.25100000000003], 'roe': 1.0, 'currency': 'USD'}, ['800.60', '801']], ['JPY hundreds', {'nuc': [512.12, 97.555], 'roe': 148.33700000000002, 'currency': 'JPY'}, ['609.67', '90500']], ['KWD tenths', {'nuc': [700.009, 100.0], 'roe': 0.30712, 'currency': 'KWD'}, ['800.00', '245.7']], ['exact local amount', {'nuc': [250.0, 250.0], 'roe': 0.92, 'currency': 'EUR'}, ['500.00', '460']], ['float product trap', {'nuc': [200.0], 'roe': 1.1, 'currency': 'USD'}, ['200.00', '220']], ['unsupported currency', {'nuc': [100.0], 'roe': 3.67, 'currency': 'AED'}, 'ERR_CURRENCY'], ['sum crosses a cent', {'nuc': [100.005, 200.006], 'roe': 0.788341, 'currency': 'GBP'}, ['300.01', '237']], ['sampled case 1', {'nuc': [563.46, 751.68, 255.98, 518.496], 'roe': 85.8739, 'currency': 'KWD'}, ['2089.61', '179443.0']], ['sampled case 2', {'nuc': [209.16, 92.65, 665.5938], 'roe': 70.378988, 'currency': 'KWD'}, ['967.40', '68084.7']], ['sampled case 3', {'nuc': [239.23, 415.82, 554.5256, 886.394], 'roe': 150.32, 'currency': 'GBP'}, ['2095.96', '315065']]], [['USD two components', {'nuc': [412.357, 388.252], 'roe': 1.0, 'currency': 'USD'}, ['800.60', '801']], ['JPY hundreds', {'nuc': [512.12, 97.555], 'roe': 148.338, 'currency': 'JPY'}, ['609.67', '90500']], ['KWD tenths', {'nuc': [700.009, 100.0], 'roe': 0.30712, 'currency': 'KWD'}, ['800.00', '245.7']], ['exact local amount', {'nuc': [250.0, 250.0], 'roe': 0.92, 'currency': 'EUR'}, ['500.00', '460']], ['float product trap', {'nuc': [400.0], 'roe': 1.1, 'currency': 'USD'}, ['400.00', '440']], ['unsupported currency', {'nuc': [100.0], 'roe': 3.67, 'currency': 'AED'}, 'ERR_CURRENCY'], ['sum crosses a cent', {'nuc': [100.005, 200.006], 'roe': 0.788341, 'currency': 'GBP'}, ['300.01', '237']], ['sampled case 1', {'nuc': [522.92, 637.956, 224.95, 711.2788], 'roe': 128.068436, 'currency': 'KWD'}, ['2097.10', '268572.4']], ['sampled case 2', {'nuc': [144.652, 317.07, 333.8817, 156.6471], 'roe': 11.54, 'currency': 'EUR'}, ['952.25', '10989']], ['sampled case 3', {'nuc': [727.197], 'roe': 115.954461, 'currency': 'EUR'}, ['727.19', '84321']]], [['USD two components', {'nuc': [412.357, 388.25300000000004], 'roe': 1.0, 'currency': 'USD'}, ['800.61', '801']], ['JPY hundreds', {'nuc': [512.12, 97.555], 'roe': 148.339, 'currency': 'JPY'}, ['609.67', '90500']], ['KWD tenths', {'nuc': [700.009, 100.0], 'roe': 0.30712, 'currency': 'KWD'}, ['800.00', '245.7']], ['exact local amount', {'nuc': [250.0, 250.0], 'roe': 0.92, 'currency': 'EUR'}, ['500.00', '460']], ['float product trap', {'nuc': [700.0], 'roe': 1.1, 'currency': 'USD'}, ['700.00', '770']], ['unsupported currency', {'nuc': [100.0], 'roe': 3.67, 'currency': 'AED'}, 'ERR_CURRENCY'], ['sum crosses a cent', {'nuc': [100.005, 200.006], 'roe': 0.788341, 'currency': 'GBP'}, ['300.01', '237']], ['sampled case 1', {'nuc': [367.07, 59.422, 404.75, 654.184], 'roe': 8.8773, 'currency': 'KWD'}, ['1485.42', '13186.6']], ['sampled case 2', {'nuc': [244.923, 449.2429, 688.15, 857.76], 'roe': 23.061535, 'currency': 'JPY'}, ['2240.07', '51700']], ['sampled case 3', {'nuc': [354.514, 161.36], 'roe': 58.707806, 'currency': 'KWD'}, ['515.87', '30285.6']]], [['USD two components', {'nuc': [412.357, 388.254], 'roe': 1.0, 'currency': 'USD'}, ['800.61', '801']], ['JPY hundreds', {'nuc': [512.12, 97.555], 'roe': 148.34, 'currency': 'JPY'}, ['609.67', '90500']], ['KWD tenths', {'nuc': [700.009, 100.0], 'roe': 0.30712, 'currency': 'KWD'}, ['800.00', '245.7']], ['exact local amount', {'nuc': [250.0, 250.0], 'roe': 0.92, 'currency': 'EUR'}, ['500.00', '460']], ['float product trap', {'nuc': [800.0], 'roe': 1.1, 'currency': 'USD'}, ['800.00', '880']], ['unsupported currency', {'nuc': [100.0], 'roe': 3.67, 'currency': 'AED'}, 'ERR_CURRENCY'], ['sum crosses a cent', {'nuc': [100.005, 200.006], 'roe': 0.788341, 'currency': 'GBP'}, ['300.01', '237']], ['sampled case 1', {'nuc': [58.672], 'roe': 29.040403, 'currency': 'USD'}, ['58.67', '1704']], ['sampled case 2', {'nuc': [303.792, 254.01, 298.5418], 'roe': 12.68, 'currency': 'GBP'}, ['856.34', '10859']], ['sampled case 3', {'nuc': [709.048], 'roe': 90.68, 'currency': 'EUR'}, ['709.04', '64296']]]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(args), expected)
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
USD two components['800.60', '801']['800.60', '801']Passed
JPY hundreds['609.67', '90500']['609.67', '90500']Passed
KWD tenths['800.00', '245.7']['800.00', '245.7']Passed
exact local amount['500.00', '460']['500.00', '460']Passed
float product trap['100.00', '111']['100.00', '110']Failed
unsupported currencyERR_CURRENCYERR_CURRENCYPassed
sum crosses a cent['300.01', '237']['300.01', '237']Passed
sampled case 1['1020.73', '83724']['1020.73', '83724']Passed
sampled case 2['103.64', '14600']['103.64', '14600']Passed
sampled case 3['1742.12', '177348']['1742.12', '177348']Passed

SHA-256 / 01fe37208f37764c33f97cbc032fc891f938cd192c8b2cc8cc5787559ef4336c

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import decimal
import math
N = 1
observations = []
def solve(x):
    units = {'USD': '1', 'EUR': '1', 'JPY': '100', 'KWD': '0.1', 'GBP': '1'}
    cur = x['currency']
    if cur not in units: return 'ERR_CURRENCY'
    nuc = sum(decimal.Decimal(str(c)) for c in x['nuc'])
    nuc = nuc.quantize(decimal.Decimal('0.01'), rounding=decimal.ROUND_DOWN)
    local = nuc * decimal.Decimal(str(x['roe']))
    u = decimal.Decimal(units[cur])
    local = decimal.Decimal(round(float(nuc) * x['roe'] / float(u) + 0.5)) * u
    return [str(nuc), str(local)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['USD two components', {'nuc': [412.357, 388.25], 'roe': 1.0, 'currency': 'USD'}, ['800.60', '801']], ['JPY hundreds', {'nuc': [512.12, 97.555], 'roe': 148.336, 'currency': 'JPY'}, ['609.67', '90500']], ['KWD tenths', {'nuc': [700.009, 100.0], 'roe': 0.30712, 'currency': 'KWD'}, ['800.00', '245.7']], ['exact local amount', {'nuc': [250.0, 250.0], 'roe': 0.92, 'currency': 'EUR'}, ['500.00', '460']], ['float product trap', {'nuc': [100.0], 'roe': 1.1, 'currency': 'USD'}, ['100.00', '110']], ['unsupported currency', {'nuc': [100.0], 'roe': 3.67, 'currency': 'AED'}, 'ERR_CURRENCY'], ['sum crosses a cent', {'nuc': [100.005, 200.006], 'roe': 0.788341, 'currency': 'GBP'}, ['300.01', '237']], ['sampled case 1', {'nuc': [803.18, 217.556], 'roe': 82.0232, 'currency': 'EUR'}, ['1020.73', '83724']], ['sampled case 2', {'nuc': [103.64], 'roe': 139.908192, 'currency': 'JPY'}, ['103.64', '14600']], ['sampled case 3', {'nuc': [310.5398, 792.913, 638.67], 'roe': 101.8, 'currency': 'EUR'}, ['1742.12', '177348']]], [['USD two components', {'nuc': [412.357, 388.25100000000003], 'roe': 1.0, 'currency': 'USD'}, ['800.60', '801']], ['JPY hundreds', {'nuc': [512.12, 97.555], 'roe': 148.33700000000002, 'currency': 'JPY'}, ['609.67', '90500']], ['KWD tenths', {'nuc': [700.009, 100.0], 'roe': 0.30712, 'currency': 'KWD'}, ['800.00', '245.7']], ['exact local amount', {'nuc': [250.0, 250.0], 'roe': 0.92, 'currency': 'EUR'}, ['500.00', '460']], ['float product trap', {'nuc': [200.0], 'roe': 1.1, 'currency': 'USD'}, ['200.00', '220']], ['unsupported currency', {'nuc': [100.0], 'roe': 3.67, 'currency': 'AED'}, 'ERR_CURRENCY'], ['sum crosses a cent', {'nuc': [100.005, 200.006], 'roe': 0.788341, 'currency': 'GBP'}, ['300.01', '237']], ['sampled case 1', {'nuc': [563.46, 751.68, 255.98, 518.496], 'roe': 85.8739, 'currency': 'KWD'}, ['2089.61', '179443.0']], ['sampled case 2', {'nuc': [209.16, 92.65, 665.5938], 'roe': 70.378988, 'currency': 'KWD'}, ['967.40', '68084.7']], ['sampled case 3', {'nuc': [239.23, 415.82, 554.5256, 886.394], 'roe': 150.32, 'currency': 'GBP'}, ['2095.96', '315065']]], [['USD two components', {'nuc': [412.357, 388.252], 'roe': 1.0, 'currency': 'USD'}, ['800.60', '801']], ['JPY hundreds', {'nuc': [512.12, 97.555], 'roe': 148.338, 'currency': 'JPY'}, ['609.67', '90500']], ['KWD tenths', {'nuc': [700.009, 100.0], 'roe': 0.30712, 'currency': 'KWD'}, ['800.00', '245.7']], ['exact local amount', {'nuc': [250.0, 250.0], 'roe': 0.92, 'currency': 'EUR'}, ['500.00', '460']], ['float product trap', {'nuc': [400.0], 'roe': 1.1, 'currency': 'USD'}, ['400.00', '440']], ['unsupported currency', {'nuc': [100.0], 'roe': 3.67, 'currency': 'AED'}, 'ERR_CURRENCY'], ['sum crosses a cent', {'nuc': [100.005, 200.006], 'roe': 0.788341, 'currency': 'GBP'}, ['300.01', '237']], ['sampled case 1', {'nuc': [522.92, 637.956, 224.95, 711.2788], 'roe': 128.068436, 'currency': 'KWD'}, ['2097.10', '268572.4']], ['sampled case 2', {'nuc': [144.652, 317.07, 333.8817, 156.6471], 'roe': 11.54, 'currency': 'EUR'}, ['952.25', '10989']], ['sampled case 3', {'nuc': [727.197], 'roe': 115.954461, 'currency': 'EUR'}, ['727.19', '84321']]], [['USD two components', {'nuc': [412.357, 388.25300000000004], 'roe': 1.0, 'currency': 'USD'}, ['800.61', '801']], ['JPY hundreds', {'nuc': [512.12, 97.555], 'roe': 148.339, 'currency': 'JPY'}, ['609.67', '90500']], ['KWD tenths', {'nuc': [700.009, 100.0], 'roe': 0.30712, 'currency': 'KWD'}, ['800.00', '245.7']], ['exact local amount', {'nuc': [250.0, 250.0], 'roe': 0.92, 'currency': 'EUR'}, ['500.00', '460']], ['float product trap', {'nuc': [700.0], 'roe': 1.1, 'currency': 'USD'}, ['700.00', '770']], ['unsupported currency', {'nuc': [100.0], 'roe': 3.67, 'currency': 'AED'}, 'ERR_CURRENCY'], ['sum crosses a cent', {'nuc': [100.005, 200.006], 'roe': 0.788341, 'currency': 'GBP'}, ['300.01', '237']], ['sampled case 1', {'nuc': [367.07, 59.422, 404.75, 654.184], 'roe': 8.8773, 'currency': 'KWD'}, ['1485.42', '13186.6']], ['sampled case 2', {'nuc': [244.923, 449.2429, 688.15, 857.76], 'roe': 23.061535, 'currency': 'JPY'}, ['2240.07', '51700']], ['sampled case 3', {'nuc': [354.514, 161.36], 'roe': 58.707806, 'currency': 'KWD'}, ['515.87', '30285.6']]], [['USD two components', {'nuc': [412.357, 388.254], 'roe': 1.0, 'currency': 'USD'}, ['800.61', '801']], ['JPY hundreds', {'nuc': [512.12, 97.555], 'roe': 148.34, 'currency': 'JPY'}, ['609.67', '90500']], ['KWD tenths', {'nuc': [700.009, 100.0], 'roe': 0.30712, 'currency': 'KWD'}, ['800.00', '245.7']], ['exact local amount', {'nuc': [250.0, 250.0], 'roe': 0.92, 'currency': 'EUR'}, ['500.00', '460']], ['float product trap', {'nuc': [800.0], 'roe': 1.1, 'currency': 'USD'}, ['800.00', '880']], ['unsupported currency', {'nuc': [100.0], 'roe': 3.67, 'currency': 'AED'}, 'ERR_CURRENCY'], ['sum crosses a cent', {'nuc': [100.005, 200.006], 'roe': 0.788341, 'currency': 'GBP'}, ['300.01', '237']], ['sampled case 1', {'nuc': [58.672], 'roe': 29.040403, 'currency': 'USD'}, ['58.67', '1704']], ['sampled case 2', {'nuc': [303.792, 254.01, 298.5418], 'roe': 12.68, 'currency': 'GBP'}, ['856.34', '10859']], ['sampled case 3', {'nuc': [709.048], 'roe': 90.68, 'currency': 'EUR'}, ['709.04', '64296']]]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(args), expected)
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
USD two components['800.60', '801']['800.60', '801']Passed
JPY hundreds['609.67', '90500']['609.67', '90500']Passed
KWD tenths['800.00', '245.7']['800.00', '245.7']Passed
exact local amount['500.00', '460']['500.00', '460']Passed
float product trap['100.00', '111']['100.00', '110']Failed
unsupported currencyERR_CURRENCYERR_CURRENCYPassed
sum crosses a cent['300.01', '237']['300.01', '237']Passed
sampled case 1['1020.73', '83724']['1020.73', '83724']Passed
sampled case 2['103.64', '14600']['103.64', '14600']Passed
sampled case 3['1742.12', '177348']['1742.12', '177348']Passed

SHA-256 / 23426499f7dafb4416883b5559d2236ef4f60e7091045d7d9df67426466d8dca

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import decimal
import math
N = 1
observations = []
def solve(x):
    units = {'USD': '1', 'EUR': '1', 'JPY': '100', 'KWD': '0.1', 'GBP': '1'}
    cur = x['currency']
    if cur not in units: return 'ERR_CURRENCY'
    nuc = sum(decimal.Decimal(str(c)) for c in x['nuc'])
    nuc = nuc.quantize(decimal.Decimal('0.01'), rounding=decimal.ROUND_DOWN)
    local = nuc * decimal.Decimal(str(x['roe']))
    u = decimal.Decimal(units[cur])
    local = (local / u).to_integral_value(rounding=decimal.ROUND_CEILING) * u
    return [str(nuc), str(local)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['USD two components', {'nuc': [412.357, 388.25], 'roe': 1.0, 'currency': 'USD'}, ['800.60', '801']], ['JPY hundreds', {'nuc': [512.12, 97.555], 'roe': 148.336, 'currency': 'JPY'}, ['609.67', '90500']], ['KWD tenths', {'nuc': [700.009, 100.0], 'roe': 0.30712, 'currency': 'KWD'}, ['800.00', '245.7']], ['exact local amount', {'nuc': [250.0, 250.0], 'roe': 0.92, 'currency': 'EUR'}, ['500.00', '460']], ['float product trap', {'nuc': [100.0], 'roe': 1.1, 'currency': 'USD'}, ['100.00', '110']], ['unsupported currency', {'nuc': [100.0], 'roe': 3.67, 'currency': 'AED'}, 'ERR_CURRENCY'], ['sum crosses a cent', {'nuc': [100.005, 200.006], 'roe': 0.788341, 'currency': 'GBP'}, ['300.01', '237']], ['sampled case 1', {'nuc': [803.18, 217.556], 'roe': 82.0232, 'currency': 'EUR'}, ['1020.73', '83724']], ['sampled case 2', {'nuc': [103.64], 'roe': 139.908192, 'currency': 'JPY'}, ['103.64', '14600']], ['sampled case 3', {'nuc': [310.5398, 792.913, 638.67], 'roe': 101.8, 'currency': 'EUR'}, ['1742.12', '177348']]], [['USD two components', {'nuc': [412.357, 388.25100000000003], 'roe': 1.0, 'currency': 'USD'}, ['800.60', '801']], ['JPY hundreds', {'nuc': [512.12, 97.555], 'roe': 148.33700000000002, 'currency': 'JPY'}, ['609.67', '90500']], ['KWD tenths', {'nuc': [700.009, 100.0], 'roe': 0.30712, 'currency': 'KWD'}, ['800.00', '245.7']], ['exact local amount', {'nuc': [250.0, 250.0], 'roe': 0.92, 'currency': 'EUR'}, ['500.00', '460']], ['float product trap', {'nuc': [200.0], 'roe': 1.1, 'currency': 'USD'}, ['200.00', '220']], ['unsupported currency', {'nuc': [100.0], 'roe': 3.67, 'currency': 'AED'}, 'ERR_CURRENCY'], ['sum crosses a cent', {'nuc': [100.005, 200.006], 'roe': 0.788341, 'currency': 'GBP'}, ['300.01', '237']], ['sampled case 1', {'nuc': [563.46, 751.68, 255.98, 518.496], 'roe': 85.8739, 'currency': 'KWD'}, ['2089.61', '179443.0']], ['sampled case 2', {'nuc': [209.16, 92.65, 665.5938], 'roe': 70.378988, 'currency': 'KWD'}, ['967.40', '68084.7']], ['sampled case 3', {'nuc': [239.23, 415.82, 554.5256, 886.394], 'roe': 150.32, 'currency': 'GBP'}, ['2095.96', '315065']]], [['USD two components', {'nuc': [412.357, 388.252], 'roe': 1.0, 'currency': 'USD'}, ['800.60', '801']], ['JPY hundreds', {'nuc': [512.12, 97.555], 'roe': 148.338, 'currency': 'JPY'}, ['609.67', '90500']], ['KWD tenths', {'nuc': [700.009, 100.0], 'roe': 0.30712, 'currency': 'KWD'}, ['800.00', '245.7']], ['exact local amount', {'nuc': [250.0, 250.0], 'roe': 0.92, 'currency': 'EUR'}, ['500.00', '460']], ['float product trap', {'nuc': [400.0], 'roe': 1.1, 'currency': 'USD'}, ['400.00', '440']], ['unsupported currency', {'nuc': [100.0], 'roe': 3.67, 'currency': 'AED'}, 'ERR_CURRENCY'], ['sum crosses a cent', {'nuc': [100.005, 200.006], 'roe': 0.788341, 'currency': 'GBP'}, ['300.01', '237']], ['sampled case 1', {'nuc': [522.92, 637.956, 224.95, 711.2788], 'roe': 128.068436, 'currency': 'KWD'}, ['2097.10', '268572.4']], ['sampled case 2', {'nuc': [144.652, 317.07, 333.8817, 156.6471], 'roe': 11.54, 'currency': 'EUR'}, ['952.25', '10989']], ['sampled case 3', {'nuc': [727.197], 'roe': 115.954461, 'currency': 'EUR'}, ['727.19', '84321']]], [['USD two components', {'nuc': [412.357, 388.25300000000004], 'roe': 1.0, 'currency': 'USD'}, ['800.61', '801']], ['JPY hundreds', {'nuc': [512.12, 97.555], 'roe': 148.339, 'currency': 'JPY'}, ['609.67', '90500']], ['KWD tenths', {'nuc': [700.009, 100.0], 'roe': 0.30712, 'currency': 'KWD'}, ['800.00', '245.7']], ['exact local amount', {'nuc': [250.0, 250.0], 'roe': 0.92, 'currency': 'EUR'}, ['500.00', '460']], ['float product trap', {'nuc': [700.0], 'roe': 1.1, 'currency': 'USD'}, ['700.00', '770']], ['unsupported currency', {'nuc': [100.0], 'roe': 3.67, 'currency': 'AED'}, 'ERR_CURRENCY'], ['sum crosses a cent', {'nuc': [100.005, 200.006], 'roe': 0.788341, 'currency': 'GBP'}, ['300.01', '237']], ['sampled case 1', {'nuc': [367.07, 59.422, 404.75, 654.184], 'roe': 8.8773, 'currency': 'KWD'}, ['1485.42', '13186.6']], ['sampled case 2', {'nuc': [244.923, 449.2429, 688.15, 857.76], 'roe': 23.061535, 'currency': 'JPY'}, ['2240.07', '51700']], ['sampled case 3', {'nuc': [354.514, 161.36], 'roe': 58.707806, 'currency': 'KWD'}, ['515.87', '30285.6']]], [['USD two components', {'nuc': [412.357, 388.254], 'roe': 1.0, 'currency': 'USD'}, ['800.61', '801']], ['JPY hundreds', {'nuc': [512.12, 97.555], 'roe': 148.34, 'currency': 'JPY'}, ['609.67', '90500']], ['KWD tenths', {'nuc': [700.009, 100.0], 'roe': 0.30712, 'currency': 'KWD'}, ['800.00', '245.7']], ['exact local amount', {'nuc': [250.0, 250.0], 'roe': 0.92, 'currency': 'EUR'}, ['500.00', '460']], ['float product trap', {'nuc': [800.0], 'roe': 1.1, 'currency': 'USD'}, ['800.00', '880']], ['unsupported currency', {'nuc': [100.0], 'roe': 3.67, 'currency': 'AED'}, 'ERR_CURRENCY'], ['sum crosses a cent', {'nuc': [100.005, 200.006], 'roe': 0.788341, 'currency': 'GBP'}, ['300.01', '237']], ['sampled case 1', {'nuc': [58.672], 'roe': 29.040403, 'currency': 'USD'}, ['58.67', '1704']], ['sampled case 2', {'nuc': [303.792, 254.01, 298.5418], 'roe': 12.68, 'currency': 'GBP'}, ['856.34', '10859']], ['sampled case 3', {'nuc': [709.048], 'roe': 90.68, 'currency': 'EUR'}, ['709.04', '64296']]]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(args), expected)
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
USD two components['800.60', '801']['800.60', '801']Passed
JPY hundreds['609.67', '90500']['609.67', '90500']Passed
KWD tenths['800.00', '245.7']['800.00', '245.7']Passed
exact local amount['500.00', '460']['500.00', '460']Passed
float product trap['100.00', '110']['100.00', '110']Passed
unsupported currencyERR_CURRENCYERR_CURRENCYPassed
sum crosses a cent['300.01', '237']['300.01', '237']Passed
sampled case 1['1020.73', '83724']['1020.73', '83724']Passed
sampled case 2['103.64', '14600']['103.64', '14600']Passed
sampled case 3['1742.12', '177348']['1742.12', '177348']Passed

SHA-256 / 688f3e202dbe14ba73ade80fadc4a6ec195a78c2c066541b07ee0d8b76750374

Verification & scope

A stipulated toy fare-rule contract with invented constants; it is not an ATPCO or carrier tariff implementation and makes no claim of industry-standard conformance. 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:47:44.968948+00:00.

Case digest / fb0d7fb0d12b22dfdbd70431d5e1ed58e9d441e7b142a00f546bdb2945c638d4