FAILURE MAP
← Case archive

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

JPY-quoted forwards use a four-decimal pip · case 01

USDJPY forward points are a hundred times too large.

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

ROOT CAUSE

The pip exponent is fixed at 4 for every pair.

VERIFIED REPAIR

Use a 2-decimal pip when the quote currency is JPY.

Unsuccessful approach: Switching on JPY in the base position leaves every JPY-quoted pair wrong.

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 = 4
    pts = ((F - 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 jpy-pip-exponent 1', ('USDJPY', '150.00', '5.00', '0.00', 180), ['146.341', '-365.85']),
  ('regression jpy-pip-exponent 2', ('AUDJPY', '98.765', '4.35', '0.10', 30), ['98.421', '-34.37']),
  ('control: euro dollar year', ('EURUSD', '1.0800', '3.60', '5.40', 360), ['1.09876', '187.64']),
  ('control: sterling dollar', ('GBPUSD', '1.2650', '5.25', '5.30', 91), ['1.26538', '3.85']),
  ('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 jpy-pip-exponent 1', ('AUDJPY', '54.4548', '0.49', '4.06', 91), ['54.947', '49.17']),
  ('regression jpy-pip-exponent 2', ('AUDJPY', '5.9212', '0.74', '1.63', 182), ['5.948', '2.68']),
  ('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 jpy-pip-exponent 1', ('GBPJPY', '137.7426', '3.56', '5.48', 1), ['137.750', '0.75']),
  ('regression jpy-pip-exponent 2', ('GBPJPY', '5.4304', '2.54', '5.76', 365), ['5.605', '17.48']),
  ('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 jpy-pip-exponent 1', ('USDJPY', '99.9582', '4.97', '2.67', 91), ['99.384', '-57.39']),
  ('regression jpy-pip-exponent 2', ('GBPJPY', '63.7106', '6.59', '7.11', 91), ['63.807', '9.67']),
  ('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 jpy-pip-exponent 1', ('AUDJPY', '25.5690', '7.90', '3.42', 182), ['25.025', '-54.37']),
  ('regression jpy-pip-exponent 2', ('GBPJPY', '111.1109', '0.75', '7.67', 30), ['111.752', '64.13']),
  ('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 fixtureActualExpectedOutcome
regression jpy-pip-exponent 1['146.34146', '-36585.37']['146.341', '-365.85']Failed
regression jpy-pip-exponent 2['98.42134', '-3436.60']['98.421', '-34.37']Failed
control: euro dollar year['1.09876', '187.64']['1.09876', '187.64']Passed
control: sterling dollar['1.26538', '3.85']['1.26538', '3.85']Passed
control: dollar cad['1.35359', '-41.12']['1.35359', '-41.12']Passed
control: euro franc['0.95078', '-4.16']['0.95078', '-4.16']Passed

SHA-256 / 0472dd7b0d660368a947096f89df665af5f6a749ae5271afe83661d82ad509d1

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 base == 'JPY' else 4
    pts = ((F - 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 jpy-pip-exponent 1', ('USDJPY', '150.00', '5.00', '0.00', 180), ['146.341', '-365.85']),
  ('regression jpy-pip-exponent 2', ('AUDJPY', '98.765', '4.35', '0.10', 30), ['98.421', '-34.37']),
  ('control: euro dollar year', ('EURUSD', '1.0800', '3.60', '5.40', 360), ['1.09876', '187.64']),
  ('control: sterling dollar', ('GBPUSD', '1.2650', '5.25', '5.30', 91), ['1.26538', '3.85']),
  ('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 jpy-pip-exponent 1', ('AUDJPY', '54.4548', '0.49', '4.06', 91), ['54.947', '49.17']),
  ('regression jpy-pip-exponent 2', ('AUDJPY', '5.9212', '0.74', '1.63', 182), ['5.948', '2.68']),
  ('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 jpy-pip-exponent 1', ('GBPJPY', '137.7426', '3.56', '5.48', 1), ['137.750', '0.75']),
  ('regression jpy-pip-exponent 2', ('GBPJPY', '5.4304', '2.54', '5.76', 365), ['5.605', '17.48']),
  ('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 jpy-pip-exponent 1', ('USDJPY', '99.9582', '4.97', '2.67', 91), ['99.384', '-57.39']),
  ('regression jpy-pip-exponent 2', ('GBPJPY', '63.7106', '6.59', '7.11', 91), ['63.807', '9.67']),
  ('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 jpy-pip-exponent 1', ('AUDJPY', '25.5690', '7.90', '3.42', 182), ['25.025', '-54.37']),
  ('regression jpy-pip-exponent 2', ('GBPJPY', '111.1109', '0.75', '7.67', 30), ['111.752', '64.13']),
  ('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 fixtureActualExpectedOutcome
regression jpy-pip-exponent 1['146.34146', '-36585.37']['146.341', '-365.85']Failed
regression jpy-pip-exponent 2['98.42134', '-3436.60']['98.421', '-34.37']Failed
control: euro dollar year['1.09876', '187.64']['1.09876', '187.64']Passed
control: sterling dollar['1.26538', '3.85']['1.26538', '3.85']Passed
control: dollar cad['1.35359', '-41.12']['1.35359', '-41.12']Passed
control: euro franc['0.95078', '-4.16']['0.95078', '-4.16']Passed

SHA-256 / 7f942e95633253d391d279d18abe935a81bc1390e02b932ea6f5478fc60dae99

3 / The verified repair

Exit 0
"""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 - 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 jpy-pip-exponent 1', ('USDJPY', '150.00', '5.00', '0.00', 180), ['146.341', '-365.85']),
  ('regression jpy-pip-exponent 2', ('AUDJPY', '98.765', '4.35', '0.10', 30), ['98.421', '-34.37']),
  ('control: euro dollar year', ('EURUSD', '1.0800', '3.60', '5.40', 360), ['1.09876', '187.64']),
  ('control: sterling dollar', ('GBPUSD', '1.2650', '5.25', '5.30', 91), ['1.26538', '3.85']),
  ('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 jpy-pip-exponent 1', ('AUDJPY', '54.4548', '0.49', '4.06', 91), ['54.947', '49.17']),
  ('regression jpy-pip-exponent 2', ('AUDJPY', '5.9212', '0.74', '1.63', 182), ['5.948', '2.68']),
  ('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 jpy-pip-exponent 1', ('GBPJPY', '137.7426', '3.56', '5.48', 1), ['137.750', '0.75']),
  ('regression jpy-pip-exponent 2', ('GBPJPY', '5.4304', '2.54', '5.76', 365), ['5.605', '17.48']),
  ('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 jpy-pip-exponent 1', ('USDJPY', '99.9582', '4.97', '2.67', 91), ['99.384', '-57.39']),
  ('regression jpy-pip-exponent 2', ('GBPJPY', '63.7106', '6.59', '7.11', 91), ['63.807', '9.67']),
  ('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 jpy-pip-exponent 1', ('AUDJPY', '25.5690', '7.90', '3.42', 182), ['25.025', '-54.37']),
  ('regression jpy-pip-exponent 2', ('GBPJPY', '111.1109', '0.75', '7.67', 30), ['111.752', '64.13']),
  ('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 fixtureActualExpectedOutcome
regression jpy-pip-exponent 1['146.341', '-365.85']['146.341', '-365.85']Passed
regression jpy-pip-exponent 2['98.421', '-34.37']['98.421', '-34.37']Passed
control: euro dollar year['1.09876', '187.64']['1.09876', '187.64']Passed
control: sterling dollar['1.26538', '3.85']['1.26538', '3.85']Passed
control: dollar cad['1.35359', '-41.12']['1.35359', '-41.12']Passed
control: euro franc['0.95078', '-4.16']['0.95078', '-4.16']Passed

SHA-256 / d1b66338abe3f26f5969741952238eebe6b14b8cc984c025a2762c1cf32b0012

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.721728+00:00.

Case digest / 35aefa6550eddd5900c1c54f226242638349b02b3914fb71172f4fe5600aef6c