FA-66571 / Airline fare rule evaluation / Open access
NUC divided by the rate of exchange · case 01
JPY fares come out at a fraction of the correct amount.
ROOT CAUSE
The conversion divides by ROE instead of multiplying.
VERIFIED REPAIR
Multiply NUC by the full-precision ROE.
Unsuccessful approach: Truncating ROE to two decimals distorts high-precision rates.
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 = (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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| USD two components | ['800.60', '801'] | ['800.60', '801'] | Passed |
| JPY hundreds | ['609.67', '100'] | ['609.67', '90500'] | Failed |
| KWD tenths | ['800.00', '2604.9'] | ['800.00', '245.7'] | Failed |
| exact local amount | ['500.00', '544'] | ['500.00', '460'] | Failed |
| float product trap | ['100.00', '91'] | ['100.00', '110'] | Failed |
| unsupported currency | ERR_CURRENCY | ERR_CURRENCY | Passed |
| sum crosses a cent | ['300.01', '381'] | ['300.01', '237'] | Failed |
| sampled case 1 | ['1020.73', '13'] | ['1020.73', '83724'] | Failed |
| sampled case 2 | ['103.64', '100'] | ['103.64', '14600'] | Failed |
| sampled case 3 | ['1742.12', '18'] | ['1742.12', '177348'] | Failed |
SHA-256 / e6f8e40de50b292ee2854f43b5e4a7a41213f9da67c8310b7500f2b30edb2fdf
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(round(x['roe'], 2)))
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| USD two components | ['800.60', '801'] | ['800.60', '801'] | Passed |
| JPY hundreds | ['609.67', '90500'] | ['609.67', '90500'] | Passed |
| KWD tenths | ['800.00', '248.0'] | ['800.00', '245.7'] | Failed |
| exact local amount | ['500.00', '460'] | ['500.00', '460'] | Passed |
| float product trap | ['100.00', '110'] | ['100.00', '110'] | Passed |
| unsupported currency | ERR_CURRENCY | ERR_CURRENCY | Passed |
| sum crosses a cent | ['300.01', '238'] | ['300.01', '237'] | Failed |
| sampled case 1 | ['1020.73', '83721'] | ['1020.73', '83724'] | Failed |
| sampled case 2 | ['103.64', '14600'] | ['103.64', '14600'] | Passed |
| sampled case 3 | ['1742.12', '177348'] | ['1742.12', '177348'] | Passed |
SHA-256 / fcee96bcfc00d93c23115144cb5691dc2047b631fe9f48da5d12b7c989074177
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| 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 currency | ERR_CURRENCY | ERR_CURRENCY | Passed |
| 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.935221+00:00.
Case digest / 7f9b252345e4f134ccddf44a76363fd54da30c2938053bdee989ca03b31117e0