FA-62131 / Currency rounding and FX conversion / Open access
French amounts grouped with a narrow no-break space are rejected · case 01
'1 234,50' from a locale-aware formatter fails to parse.
ROOT CAUSE
Only an ASCII space is recognised as the French group separator.
THE FAILURE
Only an ASCII space is recognised as the French group separator.
Unsuccessful approach: Adding U+00A0 instead of U+202F still rejects the narrow no-break space.
Case contract
solve(text, locale, exp): parse a localized amount into integer minor units at exponent exp. Group/decimal separators: en ',' '.', de '.' ',', ch "'" '.', fr ' ' or U+202F and ','. An optional leading '-' marks a negative amount (including -0.xx). If grouping is used, the first group has 1-3 digits and every later group exactly 3. A decimal separator must be followed by digits. Fraction digits beyond exp are allowed only if they are zeros, otherwise 'ERR:precision'. Malformed text returns 'ERR:format'; an unknown locale 'ERR:locale'.
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
N = 1
observations = []
def solve(text, locale, exp):
seps = {'en': (',', '.'), 'de': ('.', ','), 'ch': ("'", '.'), 'fr': (' ', ',')}
if locale not in seps: return 'ERR:locale'
groups, dec = seps[locale]
dig = lambda t: t != '' and all(c in '0123456789' for c in t)
s = text.strip()
neg = s.startswith('-')
if neg: s = s[1:]
whole, _, frac = s.partition(dec)
for g in groups[1:]: whole = whole.replace(g, groups[0])
parts = whole.split(groups[0])
if not all(dig(p) for p in parts) or (dec in s and not dig(frac)): return 'ERR:format'
if len(parts) > 1 and (len(parts[0]) > 3 or any(len(p) != 3 for p in parts[1:])): return 'ERR:format'
if frac[exp:].strip('0'): return 'ERR:precision'
frac = frac[:exp].ljust(exp, '0')
v = int(''.join(parts)) * 10 ** exp + (int(frac) if frac else 0)
return -v if neg else v
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression narrow-space-group 1', ('1\u202f234,500', 'fr', 2), 123450),
('regression narrow-space-group 2', ('-12\u202f345,6', 'fr', 2), -1234560),
('control: english grouping', ('1,234.56', 'en', 2), 123456),
('control: german short fraction', ('1.234,5', 'de', 2), 123450),
('control: negative below one', ('-0,50', 'de', 2), -50),
('control: excess precision', ('12.345', 'en', 2), 'ERR:precision')],
[('regression narrow-space-group 1', ('-12\u202f345,05', 'fr', 2), -1234505),
('regression narrow-space-group 2', ('-1\u202f234\u202f567,05', 'fr', 2), -123456705),
('partial repair guard 1', ('1\xa0234\xa0567,0010', 'fr', 2), 'ERR:format'),
('partial repair guard 2', ('1\xa0234\xa0567,5', 'fr', 3), 'ERR:format'),
('control: narrow space with trailing zero', ('1\u202f234,500', 'fr', 2), 123450),
('control: excess precision', ('12.345', 'en', 2), 'ERR:precision'),
('control: bad grouping', ('1,23,4.00', 'en', 2), 'ERR:format'),
('control: dinar fraction', ('12.5', 'en', 3), 12500)],
[('regression narrow-space-group 1', ('100\u202f000,05', 'fr', 0), 'ERR:precision'),
('regression narrow-space-group 2', ('1\u202f000,0010', 'fr', 3), 1000001),
('partial repair guard 1', ('-12\u202f345,05', 'fr', 2), -1234505),
('partial repair guard 2', ('-1\u202f234\u202f567,05', 'fr', 2), -123456705),
('control: dinar fraction', ('12.5', 'en', 3), 12500), ('control: swiss integer', ("1'000", 'ch', 0), 1000),
('control: french plain space', ('12 345,6', 'fr', 2), 1234560),
('control: dangling separator', ('12.', 'en', 2), 'ERR:format')],
[('regression narrow-space-group 1', ('1\u202f234\u202f567,500', 'fr', 2), 123456750),
('regression narrow-space-group 2', ('-1\u202f234\u202f567,123', 'fr', 2), 'ERR:precision'),
('partial repair guard 1', ('1\xa0234\xa0567,123', 'fr', 0), 'ERR:format'),
('partial repair guard 2', ('100\u202f000,05', 'fr', 0), 'ERR:precision'),
('control: dangling separator', ('12.', 'en', 2), 'ERR:format'),
('control: unknown locale', ('12', 'it', 2), 'ERR:locale'),
('control: oversized first group', ('1234,567.00', 'en', 2), 'ERR:format'),
('control: english grouping', ('1,234.56', 'en', 2), 123456)],
[('regression narrow-space-group 1', ('-1\u202f000,50', 'fr', 3), -1000500),
('regression narrow-space-group 2', ('-1\u202f234\u202f567', 'fr', 3), -1234567000),
('partial repair guard 1', ('100\xa0000,50', 'fr', 2), 'ERR:format'),
('partial repair guard 2', ('1\u202f000,0010', 'fr', 3), 1000001),
('control: english grouping', ('1,234.56', 'en', 2), 123456),
('control: german short fraction', ('1.234,5', 'de', 2), 123450),
('control: negative below one', ('-0,50', 'de', 2), -50),
('control: narrow space with trailing zero', ('1\u202f234,500', 'fr', 2), 123450)]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression narrow-space-group 1 | ERR:format | 123450 | Failed |
| regression narrow-space-group 2 | ERR:format | -1234560 | Failed |
| control: english grouping | 123456 | 123456 | Passed |
| control: german short fraction | 123450 | 123450 | Passed |
| control: negative below one | -50 | -50 | Passed |
| control: excess precision | ERR:precision | ERR:precision | Passed |
SHA-256 / 77db3d7a28f8b559f9d7397b6b95e9b21e05b1189f1fc0a62cf117e0dea4bb0c
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(text, locale, exp):
seps = {'en': (',', '.'), 'de': ('.', ','), 'ch': ("'", '.'), 'fr': (' \u00a0', ',')}
if locale not in seps: return 'ERR:locale'
groups, dec = seps[locale]
dig = lambda t: t != '' and all(c in '0123456789' for c in t)
s = text.strip()
neg = s.startswith('-')
if neg: s = s[1:]
whole, _, frac = s.partition(dec)
for g in groups[1:]: whole = whole.replace(g, groups[0])
parts = whole.split(groups[0])
if not all(dig(p) for p in parts) or (dec in s and not dig(frac)): return 'ERR:format'
if len(parts) > 1 and (len(parts[0]) > 3 or any(len(p) != 3 for p in parts[1:])): return 'ERR:format'
if frac[exp:].strip('0'): return 'ERR:precision'
frac = frac[:exp].ljust(exp, '0')
v = int(''.join(parts)) * 10 ** exp + (int(frac) if frac else 0)
return -v if neg else v
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression narrow-space-group 1', ('1\u202f234,500', 'fr', 2), 123450),
('regression narrow-space-group 2', ('-12\u202f345,6', 'fr', 2), -1234560),
('control: english grouping', ('1,234.56', 'en', 2), 123456),
('control: german short fraction', ('1.234,5', 'de', 2), 123450),
('control: negative below one', ('-0,50', 'de', 2), -50),
('control: excess precision', ('12.345', 'en', 2), 'ERR:precision')],
[('regression narrow-space-group 1', ('-12\u202f345,05', 'fr', 2), -1234505),
('regression narrow-space-group 2', ('-1\u202f234\u202f567,05', 'fr', 2), -123456705),
('partial repair guard 1', ('1\xa0234\xa0567,0010', 'fr', 2), 'ERR:format'),
('partial repair guard 2', ('1\xa0234\xa0567,5', 'fr', 3), 'ERR:format'),
('control: narrow space with trailing zero', ('1\u202f234,500', 'fr', 2), 123450),
('control: excess precision', ('12.345', 'en', 2), 'ERR:precision'),
('control: bad grouping', ('1,23,4.00', 'en', 2), 'ERR:format'),
('control: dinar fraction', ('12.5', 'en', 3), 12500)],
[('regression narrow-space-group 1', ('100\u202f000,05', 'fr', 0), 'ERR:precision'),
('regression narrow-space-group 2', ('1\u202f000,0010', 'fr', 3), 1000001),
('partial repair guard 1', ('-12\u202f345,05', 'fr', 2), -1234505),
('partial repair guard 2', ('-1\u202f234\u202f567,05', 'fr', 2), -123456705),
('control: dinar fraction', ('12.5', 'en', 3), 12500), ('control: swiss integer', ("1'000", 'ch', 0), 1000),
('control: french plain space', ('12 345,6', 'fr', 2), 1234560),
('control: dangling separator', ('12.', 'en', 2), 'ERR:format')],
[('regression narrow-space-group 1', ('1\u202f234\u202f567,500', 'fr', 2), 123456750),
('regression narrow-space-group 2', ('-1\u202f234\u202f567,123', 'fr', 2), 'ERR:precision'),
('partial repair guard 1', ('1\xa0234\xa0567,123', 'fr', 0), 'ERR:format'),
('partial repair guard 2', ('100\u202f000,05', 'fr', 0), 'ERR:precision'),
('control: dangling separator', ('12.', 'en', 2), 'ERR:format'),
('control: unknown locale', ('12', 'it', 2), 'ERR:locale'),
('control: oversized first group', ('1234,567.00', 'en', 2), 'ERR:format'),
('control: english grouping', ('1,234.56', 'en', 2), 123456)],
[('regression narrow-space-group 1', ('-1\u202f000,50', 'fr', 3), -1000500),
('regression narrow-space-group 2', ('-1\u202f234\u202f567', 'fr', 3), -1234567000),
('partial repair guard 1', ('100\xa0000,50', 'fr', 2), 'ERR:format'),
('partial repair guard 2', ('1\u202f000,0010', 'fr', 3), 1000001),
('control: english grouping', ('1,234.56', 'en', 2), 123456),
('control: german short fraction', ('1.234,5', 'de', 2), 123450),
('control: negative below one', ('-0,50', 'de', 2), -50),
('control: narrow space with trailing zero', ('1\u202f234,500', 'fr', 2), 123450)]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression narrow-space-group 1 | ERR:format | 123450 | Failed |
| regression narrow-space-group 2 | ERR:format | -1234560 | Failed |
| control: english grouping | 123456 | 123456 | Passed |
| control: german short fraction | 123450 | 123450 | Passed |
| control: negative below one | -50 | -50 | Passed |
| control: excess precision | ERR:precision | ERR:precision | Passed |
SHA-256 / 109125873c780615f448bfd8ee18215d4f4697ea28e420681cddfc36665fa6ba
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:01.743094+00:00.
Case digest / afaf4651cb6f4937db412b9e654fa921c4ecb6e0e8e70247d2f855694d232535