FA-62331 / Currency rounding and FX conversion / Open access
Forward points are derived from the rounded outright · case 01
Points disagree in the second decimal with points computed from the exact forward.
ROOT CAUSE
Points are computed from F already rounded to pip exponent + 1 decimals.
THE FAILURE
Points are computed from F already rounded to pip exponent + 1 decimals.
Unsuccessful approach: Switching the outright rounding to half-up keeps deriving points from a rounded outright and still loses hundredths of a pip.
Case contract
solve(pair, spot, base_pct, quote_pct, days): covered-interest-parity outright F = S*(1 + rq*days/Bq)/(1 + rb*days/Bb) with money-market bases GBP, AUD, CAD 365 and USD, EUR, JPY, CHF 360; rates are given in percent. The pip exponent is 2 for JPY-quoted pairs, else 4. Return [F rounded half-even to pip exponent + 1 decimals, forward points = (F - S)*10**pip_exp rounded half-even to 2 decimals] as strings, both computed from the exact F.
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(pair, spot, base_pct, quote_pct, days):
basis = {'USD': 360, 'EUR': 360, 'JPY': 360, 'CHF': 360, 'GBP': 365, 'AUD': 365, 'CAD': 365}
base, quote = pair[:3], pair[3:]
S = Decimal(spot)
rb, rq = Decimal(base_pct) / 100, Decimal(quote_pct) / 100
F = S * (1 + rq * days / basis[quote]) / (1 + rb * days / basis[base])
pe = 2 if quote == 'JPY' else 4
pts = ((F.quantize(Decimal(1).scaleb(-(pe + 1)), rounding=ROUND_HALF_EVEN) - S) * Decimal(10) ** pe).quantize(Decimal('0.01'), rounding=ROUND_HALF_EVEN)
return [format(F.quantize(Decimal(1).scaleb(-(pe + 1)), rounding=ROUND_HALF_EVEN), 'f'), format(pts, 'f')]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression points-from-rounded-forward 1', ('EURUSD', '1.0800', '3.60', '5.40', 360), ['1.09876', '187.64']),
('regression points-from-rounded-forward 2', ('USDJPY', '150.00', '5.00', '0.00', 180), ['146.341', '-365.85']),
('control: sterling dollar', ('GBPUSD', '1.2650', '5.25', '5.30', 91), ['1.26538', '3.85']),
('control: aussie yen', ('AUDJPY', '98.765', '4.35', '0.10', 30), ['98.421', '-34.37']),
('control: dollar cad', ('USDCAD', '1.3577', '5.30', '4.75', 182), ['1.35359', '-41.12']),
('control: euro franc', ('EURCHF', '0.9512', '3.75', '1.50', 7), ['0.95078', '-4.16'])],
[('regression points-from-rounded-forward 1', ('GBPUSD', '1.2650', '5.25', '5.30', 91), ['1.26538', '3.85']),
('regression points-from-rounded-forward 2', ('AUDJPY', '98.765', '4.35', '0.10', 30), ['98.421', '-34.37']),
('control: dollar cad', ('USDCAD', '1.3577', '5.30', '4.75', 182), ['1.35359', '-41.12']),
('control: euro franc', ('EURCHF', '0.9512', '3.75', '1.50', 7), ['0.95078', '-4.16']),
('control: euro dollar year', ('EURUSD', '1.0800', '3.60', '5.40', 360), ['1.09876', '187.64']),
('control: dollar yen half year', ('USDJPY', '150.00', '5.00', '0.00', 180), ['146.341', '-365.85'])],
[('regression points-from-rounded-forward 1', ('USDCAD', '1.3577', '5.30', '4.75', 182), ['1.35359', '-41.12']),
('regression points-from-rounded-forward 2', ('EURCHF', '0.9512', '3.75', '1.50', 7), ['0.95078', '-4.16']),
('control: euro dollar year', ('EURUSD', '1.0800', '3.60', '5.40', 360), ['1.09876', '187.64']),
('control: dollar yen half year', ('USDJPY', '150.00', '5.00', '0.00', 180), ['146.341', '-365.85']),
('control: sterling dollar', ('GBPUSD', '1.2650', '5.25', '5.30', 91), ['1.26538', '3.85']),
('control: aussie yen', ('AUDJPY', '98.765', '4.35', '0.10', 30), ['98.421', '-34.37'])],
[('regression points-from-rounded-forward 1', ('USDCAD', '128.6366', '0.30', '6.36', 365), ['136.40300', '77663.95']),
('regression points-from-rounded-forward 2', ('AUDJPY', '54.4548', '0.49', '4.06', 91), ['54.947', '49.17']),
('control: aussie yen', ('AUDJPY', '98.765', '4.35', '0.10', 30), ['98.421', '-34.37']),
('control: dollar cad', ('USDCAD', '1.3577', '5.30', '4.75', 182), ['1.35359', '-41.12']),
('control: euro franc', ('EURCHF', '0.9512', '3.75', '1.50', 7), ['0.95078', '-4.16']),
('control: euro dollar year', ('EURUSD', '1.0800', '3.60', '5.40', 360), ['1.09876', '187.64'])],
[('regression points-from-rounded-forward 1', ('GBPUSD', '17.5535', '4.72', '0.07', 182), ['17.15594', '-3975.59']),
('regression points-from-rounded-forward 2', ('GBPJPY', '137.7426', '3.56', '5.48', 1), ['137.750', '0.75']),
('control: euro dollar year', ('EURUSD', '1.0800', '3.60', '5.40', 360), ['1.09876', '187.64']),
('control: dollar yen half year', ('USDJPY', '150.00', '5.00', '0.00', 180), ['146.341', '-365.85']),
('control: sterling dollar', ('GBPUSD', '1.2650', '5.25', '5.30', 91), ['1.26538', '3.85']),
('control: aussie yen', ('AUDJPY', '98.765', '4.35', '0.10', 30), ['98.421', '-34.37'])]]
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 points-from-rounded-forward 1 | ['1.09876', '187.60'] | ['1.09876', '187.64'] | Failed |
| regression points-from-rounded-forward 2 | ['146.341', '-365.90'] | ['146.341', '-365.85'] | Failed |
| control: sterling dollar | ['1.26538', '3.80'] | ['1.26538', '3.85'] | Failed |
| control: aussie yen | ['98.421', '-34.40'] | ['98.421', '-34.37'] | Failed |
| control: dollar cad | ['1.35359', '-41.10'] | ['1.35359', '-41.12'] | Failed |
| control: euro franc | ['0.95078', '-4.20'] | ['0.95078', '-4.16'] | Failed |
SHA-256 / 526dbdf5d07af4016c785ef70532756c561eb91137c94f3fa0be94f11656aac1
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(pair, spot, base_pct, quote_pct, days):
basis = {'USD': 360, 'EUR': 360, 'JPY': 360, 'CHF': 360, 'GBP': 365, 'AUD': 365, 'CAD': 365}
base, quote = pair[:3], pair[3:]
S = Decimal(spot)
rb, rq = Decimal(base_pct) / 100, Decimal(quote_pct) / 100
F = S * (1 + rq * days / basis[quote]) / (1 + rb * days / basis[base])
pe = 2 if quote == 'JPY' else 4
pts = ((F.quantize(Decimal(1).scaleb(-(pe + 1)), rounding=ROUND_HALF_UP) - S) * Decimal(10) ** pe).quantize(Decimal('0.01'), rounding=ROUND_HALF_EVEN)
return [format(F.quantize(Decimal(1).scaleb(-(pe + 1)), rounding=ROUND_HALF_EVEN), 'f'), format(pts, 'f')]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression points-from-rounded-forward 1', ('EURUSD', '1.0800', '3.60', '5.40', 360), ['1.09876', '187.64']),
('regression points-from-rounded-forward 2', ('USDJPY', '150.00', '5.00', '0.00', 180), ['146.341', '-365.85']),
('control: sterling dollar', ('GBPUSD', '1.2650', '5.25', '5.30', 91), ['1.26538', '3.85']),
('control: aussie yen', ('AUDJPY', '98.765', '4.35', '0.10', 30), ['98.421', '-34.37']),
('control: dollar cad', ('USDCAD', '1.3577', '5.30', '4.75', 182), ['1.35359', '-41.12']),
('control: euro franc', ('EURCHF', '0.9512', '3.75', '1.50', 7), ['0.95078', '-4.16'])],
[('regression points-from-rounded-forward 1', ('GBPUSD', '1.2650', '5.25', '5.30', 91), ['1.26538', '3.85']),
('regression points-from-rounded-forward 2', ('AUDJPY', '98.765', '4.35', '0.10', 30), ['98.421', '-34.37']),
('control: dollar cad', ('USDCAD', '1.3577', '5.30', '4.75', 182), ['1.35359', '-41.12']),
('control: euro franc', ('EURCHF', '0.9512', '3.75', '1.50', 7), ['0.95078', '-4.16']),
('control: euro dollar year', ('EURUSD', '1.0800', '3.60', '5.40', 360), ['1.09876', '187.64']),
('control: dollar yen half year', ('USDJPY', '150.00', '5.00', '0.00', 180), ['146.341', '-365.85'])],
[('regression points-from-rounded-forward 1', ('USDCAD', '1.3577', '5.30', '4.75', 182), ['1.35359', '-41.12']),
('regression points-from-rounded-forward 2', ('EURCHF', '0.9512', '3.75', '1.50', 7), ['0.95078', '-4.16']),
('control: euro dollar year', ('EURUSD', '1.0800', '3.60', '5.40', 360), ['1.09876', '187.64']),
('control: dollar yen half year', ('USDJPY', '150.00', '5.00', '0.00', 180), ['146.341', '-365.85']),
('control: sterling dollar', ('GBPUSD', '1.2650', '5.25', '5.30', 91), ['1.26538', '3.85']),
('control: aussie yen', ('AUDJPY', '98.765', '4.35', '0.10', 30), ['98.421', '-34.37'])],
[('regression points-from-rounded-forward 1', ('USDCAD', '128.6366', '0.30', '6.36', 365), ['136.40300', '77663.95']),
('regression points-from-rounded-forward 2', ('AUDJPY', '54.4548', '0.49', '4.06', 91), ['54.947', '49.17']),
('control: aussie yen', ('AUDJPY', '98.765', '4.35', '0.10', 30), ['98.421', '-34.37']),
('control: dollar cad', ('USDCAD', '1.3577', '5.30', '4.75', 182), ['1.35359', '-41.12']),
('control: euro franc', ('EURCHF', '0.9512', '3.75', '1.50', 7), ['0.95078', '-4.16']),
('control: euro dollar year', ('EURUSD', '1.0800', '3.60', '5.40', 360), ['1.09876', '187.64'])],
[('regression points-from-rounded-forward 1', ('GBPUSD', '17.5535', '4.72', '0.07', 182), ['17.15594', '-3975.59']),
('regression points-from-rounded-forward 2', ('GBPJPY', '137.7426', '3.56', '5.48', 1), ['137.750', '0.75']),
('control: euro dollar year', ('EURUSD', '1.0800', '3.60', '5.40', 360), ['1.09876', '187.64']),
('control: dollar yen half year', ('USDJPY', '150.00', '5.00', '0.00', 180), ['146.341', '-365.85']),
('control: sterling dollar', ('GBPUSD', '1.2650', '5.25', '5.30', 91), ['1.26538', '3.85']),
('control: aussie yen', ('AUDJPY', '98.765', '4.35', '0.10', 30), ['98.421', '-34.37'])]]
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 points-from-rounded-forward 1 | ['1.09876', '187.60'] | ['1.09876', '187.64'] | Failed |
| regression points-from-rounded-forward 2 | ['146.341', '-365.90'] | ['146.341', '-365.85'] | Failed |
| control: sterling dollar | ['1.26538', '3.80'] | ['1.26538', '3.85'] | Failed |
| control: aussie yen | ['98.421', '-34.40'] | ['98.421', '-34.37'] | Failed |
| control: dollar cad | ['1.35359', '-41.10'] | ['1.35359', '-41.12'] | Failed |
| control: euro franc | ['0.95078', '-4.20'] | ['0.95078', '-4.16'] | Failed |
SHA-256 / 7b0da3a3ba789c5cfdba4f50949e3106fb723bb02e137e157556923146a7c524
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:03.674060+00:00.
Case digest / 12a0d91dd3e2e169c9485907b2421ee8c439244d5be5b667c8dd8b754ba132d5