FA-61106 / Bond day-count conventions / Open access
Discount-basis bill price and bond-equivalent yield: a 183-day bill in a 365-day basis year uses the short-dated formula · case 01
Bills just over half a 365-day year report a yield from the simple formula.
ROOT CAUSE
The branch hard-codes 183 days, the half year of a 366-day basis.
THE FAILURE
The branch hard-codes 183 days, the half year of a 366-day basis.
Unsuccessful approach: Rounding half the basis up to a whole day still admits 183 days under a 365-day basis.
Case contract
Inputs settlement and maturity [y,m,d] (1 to 364 days apart) and discount rate d. t = days. Price = 100*(1 - d*t/360). Year basis B is 366 if a 29 February lies in (settle, settle+365 days], else 365. For t <= B/2, BEY = B*d/(360 - d*t); otherwise BEY solves the quadratic with a = t/(2B) - 0.25, b = t/B, c = (price-100)/price, taking (-b + sqrt(b^2 - 4ac))/(2a). Return [price rounded 6, BEY rounded 8].
Why this case matters
Bond accrual and pricing systems depend on exact day-count arithmetic; a single-day error changes settlement cash.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import datetime
import math
N = 1
observations = []
def solve(settle, maturity, d):
S = datetime.date(*settle)
M = datetime.date(*maturity)
t = (M - S).days
def leap(y):
return (y % 4 == 0 and y % 100 != 0) or y % 400 == 0
horizon = S + datetime.timedelta(days=365)
basis = 366 if any(leap(y) and S < datetime.date(y, 2, 29) <= horizon for y in (S.year, S.year + 1)) else 365
price = 100 * (1 - d * t / 360)
if t <= 183:
bey = basis * d / (360 - d * t)
else:
a = t / (2 * basis) - 0.25
b = t / basis
c = (price - 100) / price
bey = (-b + math.sqrt(b * b - 4 * a * c)) / (2 * a)
return [round(price, 6), round(bey, 8)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression half-year threshold 1', [[2066, 5, 30], [2066, 11, 29], 0.08], [95.933333, 0.08453969]], ['regression half-year threshold 2', [[2021, 2, 3], [2021, 8, 5], 0.0525], [97.33125, 0.05468459]], ['partial repair probe 1', [[2099, 12, 15], [2100, 6, 16], 0.08], [95.933333, 0.08453969]], ['partial repair probe 2', [[2005, 5, 30], [2005, 11, 29], 0.025], [98.729167, 0.02567259]], ['boundary control 1', [[2023, 5, 1], [2023, 10, 30], 0.05], [97.472222, 0.05215161]], ['boundary control 2', [[2023, 5, 1], [2023, 10, 31], 0.05], [97.458333, 0.05215904]], ['normal control 1', [[2055, 6, 4], [2055, 12, 3], 0.0435], [97.800833, 0.04521945]], ['normal control 2', [[2028, 1, 1], [2028, 7, 12], 0.025], [98.659722, 0.02574478]]], [['regression half-year threshold 1', [[2001, 12, 28], [2002, 6, 29], 0.01], [99.491667, 0.01019055]], ['regression half-year threshold 2', [[2100, 12, 28], [2101, 6, 29], 0.0525], [97.33125, 0.05468459]], ['partial repair probe 1', [[2014, 1, 31], [2014, 8, 2], 0.08], [95.933333, 0.08453969]], ['partial repair probe 2', [[2102, 8, 20], [2103, 2, 19], 0.025], [98.729167, 0.02567259]], ['boundary control 1', [[2023, 5, 1], [2023, 10, 31], 0.05], [97.458333, 0.05215904]], ['boundary control 2', [[2023, 5, 1], [2023, 10, 30], 0.05], [97.472222, 0.05215161]], ['normal control 1', [[2027, 1, 1], [2027, 7, 1], 0.025], [98.743056, 0.02566988]], ['normal control 2', [[2096, 4, 10], [2096, 10, 8], 0.0435], [97.812917, 0.04509033]]], [['regression half-year threshold 1', [[2056, 11, 28], [2057, 5, 30], 0.0435], [97.78875, 0.04509869]], ['regression half-year threshold 2', [[2022, 7, 7], [2023, 1, 6], 0.025], [98.729167, 0.02567259]], ['partial repair probe 1', [[2008, 11, 1], [2009, 5, 3], 0.08], [95.933333, 0.08453969]], ['partial repair probe 2', [[2037, 4, 29], [2037, 10, 29], 0.025], [98.729167, 0.02567259]], ['boundary control 1', [[2023, 1, 1], [2023, 1, 2], 0.05], [99.986111, 0.05070149]], ['boundary control 2', [[2023, 5, 1], [2023, 10, 30], 0.05], [97.472222, 0.05215161]], ['normal control 1', [[2051, 9, 19], [2052, 9, 17], 0.0525], [94.691667, 0.0555986]], ['normal control 2', [[2081, 6, 16], [2081, 9, 15], 0.0525], [98.672917, 0.05394506]]], [['regression half-year threshold 1', [[2041, 8, 21], [2042, 2, 20], 0.025], [98.729167, 0.02567259]], ['regression half-year threshold 2', [[2100, 3, 1], [2100, 8, 31], 0.0525], [97.33125, 0.05468459]], ['partial repair probe 1', [[2024, 3, 15], [2024, 9, 14], 0.08], [95.933333, 0.08453969]], ['partial repair probe 2', [[2036, 5, 1], [2036, 10, 31], 0.0435], [97.78875, 0.04509869]], ['boundary control 1', [[2023, 5, 1], [2023, 10, 31], 0.05], [97.458333, 0.05215904]], ['boundary control 2', [[2023, 5, 1], [2023, 10, 30], 0.05], [97.472222, 0.05215161]], ['normal control 1', [[2033, 4, 9], [2033, 7, 9], 0.0435], [98.900417, 0.04459452]], ['normal control 2', [[2024, 12, 1], [2025, 5, 31], 0.0435], [97.812917, 0.04509033]]], [['regression half-year threshold 1', [[2053, 11, 23], [2054, 5, 25], 0.01], [99.491667, 0.01019055]], ['regression half-year threshold 2', [[2053, 5, 31], [2053, 11, 30], 0.08], [95.933333, 0.08453969]], ['partial repair probe 1', [[2100, 3, 1], [2100, 8, 31], 0.0525], [97.33125, 0.05468459]], ['partial repair probe 2', [[2099, 1, 15], [2099, 7, 17], 0.025], [98.729167, 0.02567259]], ['boundary control 1', [[2023, 5, 1], [2023, 10, 31], 0.05], [97.458333, 0.05215904]], ['boundary control 2', [[2023, 3, 1], [2024, 2, 28], 0.05], [94.944444, 0.05284575]], ['normal control 1', [[2002, 1, 7], [2002, 7, 8], 0.0525], [97.345833, 0.05468048]], ['normal control 2', [[2034, 1, 31], [2034, 5, 2], 0.025], [99.368056, 0.02550842]]]]
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 |
|---|---|---|---|
| regression half-year threshold 1 | [95.933333, 0.08454946] | [95.933333, 0.08453969] | Failed |
| regression half-year threshold 2 | [97.33125, 0.05468867] | [97.33125, 0.05468459] | Failed |
| partial repair probe 1 | [95.933333, 0.08454946] | [95.933333, 0.08453969] | Failed |
| partial repair probe 2 | [98.729167, 0.02567349] | [98.729167, 0.02567259] | Failed |
| boundary control 1 | [97.472222, 0.05215161] | [97.472222, 0.05215161] | Passed |
| boundary control 2 | [97.458333, 0.05215904] | [97.458333, 0.05215904] | Passed |
| normal control 1 | [97.800833, 0.04521945] | [97.800833, 0.04521945] | Passed |
| normal control 2 | [98.659722, 0.02574478] | [98.659722, 0.02574478] | Passed |
SHA-256 / dfacb0c09da6f4d3d30e0adb83e5b0ed6f94cdb1cab1b3f1dba2cf103807f8cf
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import datetime
import math
N = 1
observations = []
def solve(settle, maturity, d):
S = datetime.date(*settle)
M = datetime.date(*maturity)
t = (M - S).days
def leap(y):
return (y % 4 == 0 and y % 100 != 0) or y % 400 == 0
horizon = S + datetime.timedelta(days=365)
basis = 366 if any(leap(y) and S < datetime.date(y, 2, 29) <= horizon for y in (S.year, S.year + 1)) else 365
price = 100 * (1 - d * t / 360)
if t <= math.ceil(basis / 2):
bey = basis * d / (360 - d * t)
else:
a = t / (2 * basis) - 0.25
b = t / basis
c = (price - 100) / price
bey = (-b + math.sqrt(b * b - 4 * a * c)) / (2 * a)
return [round(price, 6), round(bey, 8)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression half-year threshold 1', [[2066, 5, 30], [2066, 11, 29], 0.08], [95.933333, 0.08453969]], ['regression half-year threshold 2', [[2021, 2, 3], [2021, 8, 5], 0.0525], [97.33125, 0.05468459]], ['partial repair probe 1', [[2099, 12, 15], [2100, 6, 16], 0.08], [95.933333, 0.08453969]], ['partial repair probe 2', [[2005, 5, 30], [2005, 11, 29], 0.025], [98.729167, 0.02567259]], ['boundary control 1', [[2023, 5, 1], [2023, 10, 30], 0.05], [97.472222, 0.05215161]], ['boundary control 2', [[2023, 5, 1], [2023, 10, 31], 0.05], [97.458333, 0.05215904]], ['normal control 1', [[2055, 6, 4], [2055, 12, 3], 0.0435], [97.800833, 0.04521945]], ['normal control 2', [[2028, 1, 1], [2028, 7, 12], 0.025], [98.659722, 0.02574478]]], [['regression half-year threshold 1', [[2001, 12, 28], [2002, 6, 29], 0.01], [99.491667, 0.01019055]], ['regression half-year threshold 2', [[2100, 12, 28], [2101, 6, 29], 0.0525], [97.33125, 0.05468459]], ['partial repair probe 1', [[2014, 1, 31], [2014, 8, 2], 0.08], [95.933333, 0.08453969]], ['partial repair probe 2', [[2102, 8, 20], [2103, 2, 19], 0.025], [98.729167, 0.02567259]], ['boundary control 1', [[2023, 5, 1], [2023, 10, 31], 0.05], [97.458333, 0.05215904]], ['boundary control 2', [[2023, 5, 1], [2023, 10, 30], 0.05], [97.472222, 0.05215161]], ['normal control 1', [[2027, 1, 1], [2027, 7, 1], 0.025], [98.743056, 0.02566988]], ['normal control 2', [[2096, 4, 10], [2096, 10, 8], 0.0435], [97.812917, 0.04509033]]], [['regression half-year threshold 1', [[2056, 11, 28], [2057, 5, 30], 0.0435], [97.78875, 0.04509869]], ['regression half-year threshold 2', [[2022, 7, 7], [2023, 1, 6], 0.025], [98.729167, 0.02567259]], ['partial repair probe 1', [[2008, 11, 1], [2009, 5, 3], 0.08], [95.933333, 0.08453969]], ['partial repair probe 2', [[2037, 4, 29], [2037, 10, 29], 0.025], [98.729167, 0.02567259]], ['boundary control 1', [[2023, 1, 1], [2023, 1, 2], 0.05], [99.986111, 0.05070149]], ['boundary control 2', [[2023, 5, 1], [2023, 10, 30], 0.05], [97.472222, 0.05215161]], ['normal control 1', [[2051, 9, 19], [2052, 9, 17], 0.0525], [94.691667, 0.0555986]], ['normal control 2', [[2081, 6, 16], [2081, 9, 15], 0.0525], [98.672917, 0.05394506]]], [['regression half-year threshold 1', [[2041, 8, 21], [2042, 2, 20], 0.025], [98.729167, 0.02567259]], ['regression half-year threshold 2', [[2100, 3, 1], [2100, 8, 31], 0.0525], [97.33125, 0.05468459]], ['partial repair probe 1', [[2024, 3, 15], [2024, 9, 14], 0.08], [95.933333, 0.08453969]], ['partial repair probe 2', [[2036, 5, 1], [2036, 10, 31], 0.0435], [97.78875, 0.04509869]], ['boundary control 1', [[2023, 5, 1], [2023, 10, 31], 0.05], [97.458333, 0.05215904]], ['boundary control 2', [[2023, 5, 1], [2023, 10, 30], 0.05], [97.472222, 0.05215161]], ['normal control 1', [[2033, 4, 9], [2033, 7, 9], 0.0435], [98.900417, 0.04459452]], ['normal control 2', [[2024, 12, 1], [2025, 5, 31], 0.0435], [97.812917, 0.04509033]]], [['regression half-year threshold 1', [[2053, 11, 23], [2054, 5, 25], 0.01], [99.491667, 0.01019055]], ['regression half-year threshold 2', [[2053, 5, 31], [2053, 11, 30], 0.08], [95.933333, 0.08453969]], ['partial repair probe 1', [[2100, 3, 1], [2100, 8, 31], 0.0525], [97.33125, 0.05468459]], ['partial repair probe 2', [[2099, 1, 15], [2099, 7, 17], 0.025], [98.729167, 0.02567259]], ['boundary control 1', [[2023, 5, 1], [2023, 10, 31], 0.05], [97.458333, 0.05215904]], ['boundary control 2', [[2023, 3, 1], [2024, 2, 28], 0.05], [94.944444, 0.05284575]], ['normal control 1', [[2002, 1, 7], [2002, 7, 8], 0.0525], [97.345833, 0.05468048]], ['normal control 2', [[2034, 1, 31], [2034, 5, 2], 0.025], [99.368056, 0.02550842]]]]
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 |
|---|---|---|---|
| regression half-year threshold 1 | [95.933333, 0.08454946] | [95.933333, 0.08453969] | Failed |
| regression half-year threshold 2 | [97.33125, 0.05468867] | [97.33125, 0.05468459] | Failed |
| partial repair probe 1 | [95.933333, 0.08454946] | [95.933333, 0.08453969] | Failed |
| partial repair probe 2 | [98.729167, 0.02567349] | [98.729167, 0.02567259] | Failed |
| boundary control 1 | [97.472222, 0.05215161] | [97.472222, 0.05215161] | Passed |
| boundary control 2 | [97.458333, 0.05215904] | [97.458333, 0.05215904] | Passed |
| normal control 1 | [97.800833, 0.04521945] | [97.800833, 0.04521945] | Passed |
| normal control 2 | [98.659722, 0.02574478] | [98.659722, 0.02574478] | Passed |
SHA-256 / 9762806d88621cb9a1cb18a75dab80b541c5788024d48e92654bc10664fa381a
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 8 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 toy contract stated explicitly in the contract field; no claim of conformance to any published convention text. 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:46:52.102775+00:00.
Case digest / 7eae3ae82cf01abf954751ec3d0bc7bd2198fc517eca9d07454a479073107e9f