FAILURE MAP
← Case archive

FA-61046 / Bond day-count conventions / Open access

NL/365 no-leap day count: the year fraction uses actual days while the day count excludes leap days · case 01

The two returned values disagree whenever a leap day falls inside the span.

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

ROOT CAUSE

The fraction is computed from the raw calendar difference instead of the adjusted day count.

VERIFIED REPAIR

Divide the leap-adjusted day count by 365.

Unsuccessful approach: Dividing actual days by 366 when a leap day is present only approximates the no-leap count.

Case contract

Inputs start and end [y,m,d]. If end < start return "end before start". Days are actual days minus the number of 29 February dates lying in (start, end]. Return [days, days/365 rounded to 9 decimals].

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
from fractions import Fraction
N = 1
observations = []
def solve(a, b):
    A = datetime.date(*a)
    B = datetime.date(*b)
    if B < A:
        return 'end before start'
    def leap(y):
        return (y % 4 == 0 and y % 100 != 0) or y % 400 == 0
    leapdays = sum(1 for y in range(A.year, B.year + 1) if leap(y) and A < datetime.date(y, 2, 29) <= B)
    days = (B - A).days - leapdays
    return [days, round((B - A).days / 365, 9)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression fraction numerator 1', [[2104, 2, 28], [2112, 1, 7]], [2868, 7.857534247]], ['regression fraction numerator 2', [[1986, 2, 27], [1991, 10, 9]], [2049, 5.61369863]], ['partial repair probe 1', [[2104, 1, 1], [2113, 1, 13]], [3297, 9.032876712]], ['partial repair probe 2', [[2034, 2, 27], [2038, 8, 21]], [1635, 4.479452055]], ['boundary control 1', [[2024, 2, 29], [2025, 2, 28]], [365, 1.0]], ['boundary control 2', [[2020, 1, 1], [2020, 1, 1]], [0, 0.0]], ['normal control 1', [[1896, 3, 15], [1899, 8, 25]], [1258, 3.446575342]], ['normal control 2', [[2068, 5, 7], [2069, 2, 20]], [289, 0.791780822]]], [['regression fraction numerator 1', [[2090, 11, 1], [2098, 8, 15]], [2842, 7.78630137]], ['regression fraction numerator 2', [[2005, 6, 30], [2008, 3, 20]], [993, 2.720547945]], ['partial repair probe 1', [[2024, 2, 15], [2029, 8, 29]], [2020, 5.534246575]], ['partial repair probe 2', [[2017, 4, 30], [2021, 2, 26]], [1397, 3.82739726]], ['boundary control 1', [[2024, 3, 1], [2024, 12, 31]], [305, 0.835616438]], ['boundary control 2', [[2099, 1, 1], [2101, 1, 1]], [730, 2.0]], ['normal control 1', [[2067, 1, 24], [2067, 6, 15]], [142, 0.389041096]], ['normal control 2', [[2052, 10, 31], [2053, 1, 24]], [85, 0.232876712]]], [['regression fraction numerator 1', [[2023, 8, 22], [2030, 1, 9]], [2330, 6.383561644]], ['regression fraction numerator 2', [[2011, 4, 28], [2012, 4, 29]], [366, 1.002739726]], ['partial repair probe 1', [[1983, 3, 17], [1986, 3, 10]], [1088, 2.980821918]], ['partial repair probe 2', [[2096, 2, 15], [2101, 4, 10]], [1879, 5.147945205]], ['boundary control 1', [[2024, 3, 1], [2024, 12, 31]], [305, 0.835616438]], ['boundary control 2', [[2024, 2, 29], [2025, 2, 28]], [365, 1.0]], ['normal control 1', [[1919, 5, 31], [1920, 2, 5]], [250, 0.684931507]], ['normal control 2', [[1942, 5, 31], [1943, 7, 20]], [415, 1.136986301]]], [['regression fraction numerator 1', [[2046, 10, 17], [2049, 8, 5]], [1022, 2.8]], ['regression fraction numerator 2', [[2104, 2, 28], [2105, 9, 1]], [550, 1.506849315]], ['partial repair probe 1', [[2103, 7, 31], [2110, 7, 22]], [2546, 6.975342466]], ['partial repair probe 2', [[1976, 4, 30], [1982, 8, 31]], [2313, 6.336986301]], ['boundary control 1', [[2024, 3, 1], [2024, 12, 31]], [305, 0.835616438]], ['boundary control 2', [[2099, 1, 1], [2101, 1, 1]], [730, 2.0]], ['normal control 1', [[1904, 3, 1], [1904, 6, 24]], [115, 0.315068493]], ['normal control 2', [[2027, 7, 31], [2027, 11, 6]], [98, 0.268493151]]], [['regression fraction numerator 1', [[1988, 9, 2], [1994, 12, 11]], [2290, 6.273972603]], ['regression fraction numerator 2', [[1996, 3, 15], [2001, 1, 23]], [1774, 4.860273973]], ['partial repair probe 1', [[1941, 8, 31], [1952, 3, 31]], [3862, 10.580821918]], ['partial repair probe 2', [[1932, 4, 20], [1938, 5, 16]], [2216, 6.071232877]], ['boundary control 1', [[2024, 2, 29], [2025, 2, 28]], [365, 1.0]], ['boundary control 2', [[2020, 1, 1], [2020, 1, 1]], [0, 0.0]], ['normal control 1', [[2104, 3, 15], [2104, 10, 30]], [229, 0.62739726]], ['normal control 2', [[1909, 8, 31], [1909, 11, 13]], [74, 0.202739726]]]]
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 fixtureActualExpectedOutcome
regression fraction numerator 1[2868, 7.863013699][2868, 7.857534247]Failed
regression fraction numerator 2[2049, 5.616438356][2049, 5.61369863]Failed
partial repair probe 1[3297, 9.04109589][3297, 9.032876712]Failed
partial repair probe 2[1635, 4.482191781][1635, 4.479452055]Failed
boundary control 1[365, 1.0][365, 1.0]Passed
boundary control 2[0, 0.0][0, 0.0]Passed
normal control 1[1258, 3.446575342][1258, 3.446575342]Passed
normal control 2[289, 0.791780822][289, 0.791780822]Passed

SHA-256 / 774128822c6b9966d8403348036444c44ee7e37ca6c4224967df455ef7b15778

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import datetime
from fractions import Fraction
N = 1
observations = []
def solve(a, b):
    A = datetime.date(*a)
    B = datetime.date(*b)
    if B < A:
        return 'end before start'
    def leap(y):
        return (y % 4 == 0 and y % 100 != 0) or y % 400 == 0
    leapdays = sum(1 for y in range(A.year, B.year + 1) if leap(y) and A < datetime.date(y, 2, 29) <= B)
    days = (B - A).days - leapdays
    return [days, round((B - A).days / (366 if leapdays else 365), 9)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression fraction numerator 1', [[2104, 2, 28], [2112, 1, 7]], [2868, 7.857534247]], ['regression fraction numerator 2', [[1986, 2, 27], [1991, 10, 9]], [2049, 5.61369863]], ['partial repair probe 1', [[2104, 1, 1], [2113, 1, 13]], [3297, 9.032876712]], ['partial repair probe 2', [[2034, 2, 27], [2038, 8, 21]], [1635, 4.479452055]], ['boundary control 1', [[2024, 2, 29], [2025, 2, 28]], [365, 1.0]], ['boundary control 2', [[2020, 1, 1], [2020, 1, 1]], [0, 0.0]], ['normal control 1', [[1896, 3, 15], [1899, 8, 25]], [1258, 3.446575342]], ['normal control 2', [[2068, 5, 7], [2069, 2, 20]], [289, 0.791780822]]], [['regression fraction numerator 1', [[2090, 11, 1], [2098, 8, 15]], [2842, 7.78630137]], ['regression fraction numerator 2', [[2005, 6, 30], [2008, 3, 20]], [993, 2.720547945]], ['partial repair probe 1', [[2024, 2, 15], [2029, 8, 29]], [2020, 5.534246575]], ['partial repair probe 2', [[2017, 4, 30], [2021, 2, 26]], [1397, 3.82739726]], ['boundary control 1', [[2024, 3, 1], [2024, 12, 31]], [305, 0.835616438]], ['boundary control 2', [[2099, 1, 1], [2101, 1, 1]], [730, 2.0]], ['normal control 1', [[2067, 1, 24], [2067, 6, 15]], [142, 0.389041096]], ['normal control 2', [[2052, 10, 31], [2053, 1, 24]], [85, 0.232876712]]], [['regression fraction numerator 1', [[2023, 8, 22], [2030, 1, 9]], [2330, 6.383561644]], ['regression fraction numerator 2', [[2011, 4, 28], [2012, 4, 29]], [366, 1.002739726]], ['partial repair probe 1', [[1983, 3, 17], [1986, 3, 10]], [1088, 2.980821918]], ['partial repair probe 2', [[2096, 2, 15], [2101, 4, 10]], [1879, 5.147945205]], ['boundary control 1', [[2024, 3, 1], [2024, 12, 31]], [305, 0.835616438]], ['boundary control 2', [[2024, 2, 29], [2025, 2, 28]], [365, 1.0]], ['normal control 1', [[1919, 5, 31], [1920, 2, 5]], [250, 0.684931507]], ['normal control 2', [[1942, 5, 31], [1943, 7, 20]], [415, 1.136986301]]], [['regression fraction numerator 1', [[2046, 10, 17], [2049, 8, 5]], [1022, 2.8]], ['regression fraction numerator 2', [[2104, 2, 28], [2105, 9, 1]], [550, 1.506849315]], ['partial repair probe 1', [[2103, 7, 31], [2110, 7, 22]], [2546, 6.975342466]], ['partial repair probe 2', [[1976, 4, 30], [1982, 8, 31]], [2313, 6.336986301]], ['boundary control 1', [[2024, 3, 1], [2024, 12, 31]], [305, 0.835616438]], ['boundary control 2', [[2099, 1, 1], [2101, 1, 1]], [730, 2.0]], ['normal control 1', [[1904, 3, 1], [1904, 6, 24]], [115, 0.315068493]], ['normal control 2', [[2027, 7, 31], [2027, 11, 6]], [98, 0.268493151]]], [['regression fraction numerator 1', [[1988, 9, 2], [1994, 12, 11]], [2290, 6.273972603]], ['regression fraction numerator 2', [[1996, 3, 15], [2001, 1, 23]], [1774, 4.860273973]], ['partial repair probe 1', [[1941, 8, 31], [1952, 3, 31]], [3862, 10.580821918]], ['partial repair probe 2', [[1932, 4, 20], [1938, 5, 16]], [2216, 6.071232877]], ['boundary control 1', [[2024, 2, 29], [2025, 2, 28]], [365, 1.0]], ['boundary control 2', [[2020, 1, 1], [2020, 1, 1]], [0, 0.0]], ['normal control 1', [[2104, 3, 15], [2104, 10, 30]], [229, 0.62739726]], ['normal control 2', [[1909, 8, 31], [1909, 11, 13]], [74, 0.202739726]]]]
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 fixtureActualExpectedOutcome
regression fraction numerator 1[2868, 7.841530055][2868, 7.857534247]Failed
regression fraction numerator 2[2049, 5.601092896][2049, 5.61369863]Failed
partial repair probe 1[3297, 9.016393443][3297, 9.032876712]Failed
partial repair probe 2[1635, 4.469945355][1635, 4.479452055]Failed
boundary control 1[365, 1.0][365, 1.0]Passed
boundary control 2[0, 0.0][0, 0.0]Passed
normal control 1[1258, 3.446575342][1258, 3.446575342]Passed
normal control 2[289, 0.791780822][289, 0.791780822]Passed

SHA-256 / 078e7ff6bdabd8f83c50b88554a2f6e4509795d69288fcfa541778e9e6aeb0b4

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import datetime
from fractions import Fraction
N = 1
observations = []
def solve(a, b):
    A = datetime.date(*a)
    B = datetime.date(*b)
    if B < A:
        return 'end before start'
    def leap(y):
        return (y % 4 == 0 and y % 100 != 0) or y % 400 == 0
    leapdays = sum(1 for y in range(A.year, B.year + 1) if leap(y) and A < datetime.date(y, 2, 29) <= B)
    days = (B - A).days - leapdays
    return [days, round(days / 365, 9)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression fraction numerator 1', [[2104, 2, 28], [2112, 1, 7]], [2868, 7.857534247]], ['regression fraction numerator 2', [[1986, 2, 27], [1991, 10, 9]], [2049, 5.61369863]], ['partial repair probe 1', [[2104, 1, 1], [2113, 1, 13]], [3297, 9.032876712]], ['partial repair probe 2', [[2034, 2, 27], [2038, 8, 21]], [1635, 4.479452055]], ['boundary control 1', [[2024, 2, 29], [2025, 2, 28]], [365, 1.0]], ['boundary control 2', [[2020, 1, 1], [2020, 1, 1]], [0, 0.0]], ['normal control 1', [[1896, 3, 15], [1899, 8, 25]], [1258, 3.446575342]], ['normal control 2', [[2068, 5, 7], [2069, 2, 20]], [289, 0.791780822]]], [['regression fraction numerator 1', [[2090, 11, 1], [2098, 8, 15]], [2842, 7.78630137]], ['regression fraction numerator 2', [[2005, 6, 30], [2008, 3, 20]], [993, 2.720547945]], ['partial repair probe 1', [[2024, 2, 15], [2029, 8, 29]], [2020, 5.534246575]], ['partial repair probe 2', [[2017, 4, 30], [2021, 2, 26]], [1397, 3.82739726]], ['boundary control 1', [[2024, 3, 1], [2024, 12, 31]], [305, 0.835616438]], ['boundary control 2', [[2099, 1, 1], [2101, 1, 1]], [730, 2.0]], ['normal control 1', [[2067, 1, 24], [2067, 6, 15]], [142, 0.389041096]], ['normal control 2', [[2052, 10, 31], [2053, 1, 24]], [85, 0.232876712]]], [['regression fraction numerator 1', [[2023, 8, 22], [2030, 1, 9]], [2330, 6.383561644]], ['regression fraction numerator 2', [[2011, 4, 28], [2012, 4, 29]], [366, 1.002739726]], ['partial repair probe 1', [[1983, 3, 17], [1986, 3, 10]], [1088, 2.980821918]], ['partial repair probe 2', [[2096, 2, 15], [2101, 4, 10]], [1879, 5.147945205]], ['boundary control 1', [[2024, 3, 1], [2024, 12, 31]], [305, 0.835616438]], ['boundary control 2', [[2024, 2, 29], [2025, 2, 28]], [365, 1.0]], ['normal control 1', [[1919, 5, 31], [1920, 2, 5]], [250, 0.684931507]], ['normal control 2', [[1942, 5, 31], [1943, 7, 20]], [415, 1.136986301]]], [['regression fraction numerator 1', [[2046, 10, 17], [2049, 8, 5]], [1022, 2.8]], ['regression fraction numerator 2', [[2104, 2, 28], [2105, 9, 1]], [550, 1.506849315]], ['partial repair probe 1', [[2103, 7, 31], [2110, 7, 22]], [2546, 6.975342466]], ['partial repair probe 2', [[1976, 4, 30], [1982, 8, 31]], [2313, 6.336986301]], ['boundary control 1', [[2024, 3, 1], [2024, 12, 31]], [305, 0.835616438]], ['boundary control 2', [[2099, 1, 1], [2101, 1, 1]], [730, 2.0]], ['normal control 1', [[1904, 3, 1], [1904, 6, 24]], [115, 0.315068493]], ['normal control 2', [[2027, 7, 31], [2027, 11, 6]], [98, 0.268493151]]], [['regression fraction numerator 1', [[1988, 9, 2], [1994, 12, 11]], [2290, 6.273972603]], ['regression fraction numerator 2', [[1996, 3, 15], [2001, 1, 23]], [1774, 4.860273973]], ['partial repair probe 1', [[1941, 8, 31], [1952, 3, 31]], [3862, 10.580821918]], ['partial repair probe 2', [[1932, 4, 20], [1938, 5, 16]], [2216, 6.071232877]], ['boundary control 1', [[2024, 2, 29], [2025, 2, 28]], [365, 1.0]], ['boundary control 2', [[2020, 1, 1], [2020, 1, 1]], [0, 0.0]], ['normal control 1', [[2104, 3, 15], [2104, 10, 30]], [229, 0.62739726]], ['normal control 2', [[1909, 8, 31], [1909, 11, 13]], [74, 0.202739726]]]]
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 fixtureActualExpectedOutcome
regression fraction numerator 1[2868, 7.857534247][2868, 7.857534247]Passed
regression fraction numerator 2[2049, 5.61369863][2049, 5.61369863]Passed
partial repair probe 1[3297, 9.032876712][3297, 9.032876712]Passed
partial repair probe 2[1635, 4.479452055][1635, 4.479452055]Passed
boundary control 1[365, 1.0][365, 1.0]Passed
boundary control 2[0, 0.0][0, 0.0]Passed
normal control 1[1258, 3.446575342][1258, 3.446575342]Passed
normal control 2[289, 0.791780822][289, 0.791780822]Passed

SHA-256 / 42bcd279c0cd2c63af53f90feb5a7b0bd240c2604a902b6965fd26ac6118ac72

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

Case digest / ab2e52595bd6ee39663d08e0dbc4ab713c649b6d0726e95183e1bc0373cb2b35