FAILURE MAP
← Case archive

FA-62241 / Currency rounding and FX conversion / Open access

Redenomination ignores a change in minor-unit exponent · case 01

A zero-decimal legacy currency converted into a two-decimal currency is a hundred times too small.

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

ROOT CAUSE

The factor 10**(new_exp - old_exp) is omitted.

THE FAILURE

The factor 10**(new_exp - old_exp) is omitted.

Unsuccessful approach: Rescaling by 10**(old_exp - new_exp) inverts the adjustment.

Case contract

solve(amount_minor, date, cutover, factor, old_exp, new_exp): amounts dated on or after the cutover (ISO date strings) are already in the new currency and returned unchanged as [amount_minor, 'native']. Earlier amounts are old-currency minor units: new = amount_minor / factor * 10**(new_exp - old_exp), rounded half away from zero, returned as [new, 'converted']. factor is old units per new unit.

Why this case matters

Currency amounts must be rounded at the right stage and in the right unit, or ledgers, quotes and settlements drift by minor units.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
from decimal import Decimal, ROUND_HALF_EVEN, ROUND_HALF_UP, ROUND_FLOOR, ROUND_CEILING, ROUND_DOWN, ROUND_UP, ROUND_HALF_DOWN
N = 1
observations = []
def solve(amount_minor, date, cutover, factor, old_exp, new_exp):
    if date >= cutover: return [amount_minor, 'native']
    v = Decimal(amount_minor) / factor * 1
    return [int(v.quantize(Decimal(1), rounding=ROUND_HALF_UP)), 'converted']
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression exponent-change 1', (1234567, '2025-12-31', '2026-01-01', 1000, 0, 2), [123457, 'converted']),
  ('regression exponent-change 2', (-2744763, '2026-06-01', '2026-07-01', 100, 2, 3), [-274476, 'converted']),
  ('control: before cutover', (1234567, '2026-06-30', '2026-07-01', 10000, 2, 2), [123, 'converted']),
  ('control: negative tie', (-15000, '2026-01-01', '2026-07-01', 10000, 2, 2), [-2, 'converted']),
  ('control: cutover day', (500, '2026-07-01', '2026-07-01', 10000, 2, 2), [500, 'native']),
  ('control: same month earlier', (99999, '2026-07-15', '2026-07-20', 100, 2, 2), [1000, 'converted'])],
 [('regression exponent-change 1', (15980147, '2026-05-22', '2026-07-15', 10000, 0, 3), [1598015, 'converted']),
  ('regression exponent-change 2', (13591002, '2026-07-05', '2026-07-15', 1000, 2, 3), [135910, 'converted']),
  ('control: exponent gain', (1234567, '2025-12-31', '2026-01-01', 1000, 0, 2), [123457, 'converted']),
  ('control: same month earlier', (99999, '2026-07-15', '2026-07-20', 100, 2, 2), [1000, 'converted']),
  ('control: after', (77, '2027-01-01', '2026-07-01', 10000, 2, 2), [77, 'native']),
  ('control: small old amount', (4999, '2026-06-01', '2026-07-01', 10000, 2, 2), [0, 'converted'])],
 [('regression exponent-change 1', (10748129, '2026-07-06', '2026-07-20', 10000, 0, 2), [107481, 'converted']),
  ('regression exponent-change 2', (13003559, '2026-07-14', '2026-07-20', 10000, 2, 3), [13004, 'converted']),
  ('control: small old amount', (4999, '2026-06-01', '2026-07-01', 10000, 2, 2), [0, 'converted']),
  ('control: before cutover', (1234567, '2026-06-30', '2026-07-01', 10000, 2, 2), [123, 'converted']),
  ('control: negative tie', (-15000, '2026-01-01', '2026-07-01', 10000, 2, 2), [-2, 'converted']),
  ('control: cutover day', (500, '2026-07-01', '2026-07-01', 10000, 2, 2), [500, 'native'])],
 [('regression exponent-change 1', (1650321, '2026-06-28', '2026-07-15', 10000, 0, 3), [165032, 'converted']),
  ('regression exponent-change 2', (8481473, '2026-05-16', '2026-07-15', 10000, 0, 2), [84815, 'converted']),
  ('control: cutover day', (500, '2026-07-01', '2026-07-01', 10000, 2, 2), [500, 'native']),
  ('control: exponent gain', (1234567, '2025-12-31', '2026-01-01', 1000, 0, 2), [123457, 'converted']),
  ('control: same month earlier', (99999, '2026-07-15', '2026-07-20', 100, 2, 2), [1000, 'converted']),
  ('control: after', (77, '2027-01-01', '2026-07-01', 10000, 2, 2), [77, 'native'])],
 [('regression exponent-change 1', (20559948, '2026-07-01', '2026-07-20', 10000, 0, 3), [2055995, 'converted']),
  ('regression exponent-change 2', (9508148, '2026-07-07', '2026-07-20', 1000, 0, 3), [9508148, 'converted']),
  ('control: after', (77, '2027-01-01', '2026-07-01', 10000, 2, 2), [77, 'native']),
  ('control: small old amount', (4999, '2026-06-01', '2026-07-01', 10000, 2, 2), [0, 'converted']),
  ('control: before cutover', (1234567, '2026-06-30', '2026-07-01', 10000, 2, 2), [123, 'converted']),
  ('control: negative tie', (-15000, '2026-01-01', '2026-07-01', 10000, 2, 2), [-2, 'converted'])]]
for label, args, expected in cases[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
regression exponent-change 1[1235, 'converted'][123457, 'converted']Failed
regression exponent-change 2[-27448, 'converted'][-274476, 'converted']Failed
control: before cutover[123, 'converted'][123, 'converted']Passed
control: negative tie[-2, 'converted'][-2, 'converted']Passed
control: cutover day[500, 'native'][500, 'native']Passed
control: same month earlier[1000, 'converted'][1000, 'converted']Passed

SHA-256 / ad36bab2479de417964ae006878bf7a992450b6cb51c8faa308b82cd3798b341

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
from decimal import Decimal, ROUND_HALF_EVEN, ROUND_HALF_UP, ROUND_FLOOR, ROUND_CEILING, ROUND_DOWN, ROUND_UP, ROUND_HALF_DOWN
N = 1
observations = []
def solve(amount_minor, date, cutover, factor, old_exp, new_exp):
    if date >= cutover: return [amount_minor, 'native']
    v = Decimal(amount_minor) / factor * Decimal(10) ** (old_exp - new_exp)
    return [int(v.quantize(Decimal(1), rounding=ROUND_HALF_UP)), 'converted']
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression exponent-change 1', (1234567, '2025-12-31', '2026-01-01', 1000, 0, 2), [123457, 'converted']),
  ('regression exponent-change 2', (-2744763, '2026-06-01', '2026-07-01', 100, 2, 3), [-274476, 'converted']),
  ('control: before cutover', (1234567, '2026-06-30', '2026-07-01', 10000, 2, 2), [123, 'converted']),
  ('control: negative tie', (-15000, '2026-01-01', '2026-07-01', 10000, 2, 2), [-2, 'converted']),
  ('control: cutover day', (500, '2026-07-01', '2026-07-01', 10000, 2, 2), [500, 'native']),
  ('control: same month earlier', (99999, '2026-07-15', '2026-07-20', 100, 2, 2), [1000, 'converted'])],
 [('regression exponent-change 1', (15980147, '2026-05-22', '2026-07-15', 10000, 0, 3), [1598015, 'converted']),
  ('regression exponent-change 2', (13591002, '2026-07-05', '2026-07-15', 1000, 2, 3), [135910, 'converted']),
  ('control: exponent gain', (1234567, '2025-12-31', '2026-01-01', 1000, 0, 2), [123457, 'converted']),
  ('control: same month earlier', (99999, '2026-07-15', '2026-07-20', 100, 2, 2), [1000, 'converted']),
  ('control: after', (77, '2027-01-01', '2026-07-01', 10000, 2, 2), [77, 'native']),
  ('control: small old amount', (4999, '2026-06-01', '2026-07-01', 10000, 2, 2), [0, 'converted'])],
 [('regression exponent-change 1', (10748129, '2026-07-06', '2026-07-20', 10000, 0, 2), [107481, 'converted']),
  ('regression exponent-change 2', (13003559, '2026-07-14', '2026-07-20', 10000, 2, 3), [13004, 'converted']),
  ('control: small old amount', (4999, '2026-06-01', '2026-07-01', 10000, 2, 2), [0, 'converted']),
  ('control: before cutover', (1234567, '2026-06-30', '2026-07-01', 10000, 2, 2), [123, 'converted']),
  ('control: negative tie', (-15000, '2026-01-01', '2026-07-01', 10000, 2, 2), [-2, 'converted']),
  ('control: cutover day', (500, '2026-07-01', '2026-07-01', 10000, 2, 2), [500, 'native'])],
 [('regression exponent-change 1', (1650321, '2026-06-28', '2026-07-15', 10000, 0, 3), [165032, 'converted']),
  ('regression exponent-change 2', (8481473, '2026-05-16', '2026-07-15', 10000, 0, 2), [84815, 'converted']),
  ('control: cutover day', (500, '2026-07-01', '2026-07-01', 10000, 2, 2), [500, 'native']),
  ('control: exponent gain', (1234567, '2025-12-31', '2026-01-01', 1000, 0, 2), [123457, 'converted']),
  ('control: same month earlier', (99999, '2026-07-15', '2026-07-20', 100, 2, 2), [1000, 'converted']),
  ('control: after', (77, '2027-01-01', '2026-07-01', 10000, 2, 2), [77, 'native'])],
 [('regression exponent-change 1', (20559948, '2026-07-01', '2026-07-20', 10000, 0, 3), [2055995, 'converted']),
  ('regression exponent-change 2', (9508148, '2026-07-07', '2026-07-20', 1000, 0, 3), [9508148, 'converted']),
  ('control: after', (77, '2027-01-01', '2026-07-01', 10000, 2, 2), [77, 'native']),
  ('control: small old amount', (4999, '2026-06-01', '2026-07-01', 10000, 2, 2), [0, 'converted']),
  ('control: before cutover', (1234567, '2026-06-30', '2026-07-01', 10000, 2, 2), [123, 'converted']),
  ('control: negative tie', (-15000, '2026-01-01', '2026-07-01', 10000, 2, 2), [-2, 'converted'])]]
for label, args, expected in cases[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
regression exponent-change 1[12, 'converted'][123457, 'converted']Failed
regression exponent-change 2[-2745, 'converted'][-274476, 'converted']Failed
control: before cutover[123, 'converted'][123, 'converted']Passed
control: negative tie[-2, 'converted'][-2, 'converted']Passed
control: cutover day[500, 'native'][500, 'native']Passed
control: same month earlier[1000, 'converted'][1000, 'converted']Passed

SHA-256 / bdb5ce3ea346b96ca805d70f3c0c1575f7a41519e9ed2bf40337c0f9741f48c8

HELD IN THE MEMBER ARCHIVE

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

This mechanism has 6 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

A deterministic, bounded teaching model with a stipulated toy contract; it makes no claim of conformance to any real regulation, standard, or institution's rules. 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:02.743781+00:00.

Case digest / 88cb4f41b73a4254f858753d227d4f4af66284d168c906974bd79f9690a894fa