FAILURE MAP
← Case archive

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

Act/365L denominator selection: sub-annual periods look at the start year · case 01

Quarterly periods that begin in December before a leap year use 365 days.

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

ROOT CAUSE

The non-annual branch tests the leap status of the start year instead of the end year.

THE FAILURE

The non-annual branch tests the leap status of the start year instead of the end year.

Unsuccessful approach: Accepting either year makes periods leaving a leap year use 366 as well.

Case contract

Inputs start, end ([y,m,d]) and coupon frequency. Days are actual days. For annual frequency the denominator is 366 if any 29 February lies in (start, end], else 365. For other frequencies the denominator is 366 if the end date year is a leap year, else 365. Return days/denominator 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, freq):
    A = datetime.date(*a)
    B = datetime.date(*b)
    def leap(y):
        return (y % 4 == 0 and y % 100 != 0) or y % 400 == 0
    days = (B - A).days
    if freq == 1:
        has29 = any(leap(y) and A < datetime.date(y, 2, 29) <= B for y in range(A.year, B.year + 1))
        den = 366 if has29 else 365
    else:
        den = 366 if leap(A.year) else 365
    return round(days / den, 9)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression non-annual year choice 1', [[2096, 12, 15], [2097, 3, 15], 4], 0.246575342], ['regression non-annual year choice 2', [[1916, 10, 19], [1917, 7, 19], 4], 0.747945205], ['partial repair probe 1', [[1908, 11, 30], [1909, 3, 29], 2], 0.326027397], ['partial repair probe 2', [[2000, 12, 29], [2001, 3, 29], 4], 0.246575342], ['boundary control 1', [[2023, 3, 1], [2024, 3, 1], 1], 1.0], ['boundary control 2', [[2023, 2, 28], [2024, 2, 29], 1], 1.0], ['normal control 1', [[2103, 1, 29], [2103, 3, 13], 1], 0.117808219], ['normal control 2', [[2096, 1, 29], [2096, 7, 29], 2], 0.49726776]], [['regression non-annual year choice 1', [[1999, 12, 15], [2000, 3, 15], 4], 0.24863388], ['regression non-annual year choice 2', [[2012, 3, 18], [2013, 4, 12], 2], 1.068493151], ['partial repair probe 1', [[2096, 3, 29], [2097, 1, 3], 4], 0.767123288], ['partial repair probe 2', [[2080, 5, 1], [2081, 2, 1], 4], 0.756164384], ['boundary control 1', [[2023, 3, 1], [2024, 3, 1], 1], 1.0], ['boundary control 2', [[2023, 2, 28], [2024, 2, 29], 1], 1.0], ['normal control 1', [[1912, 6, 19], [1913, 6, 19], 1], 1.0], ['normal control 2', [[1963, 9, 30], [1964, 9, 30], 1], 1.0]], [['regression non-annual year choice 1', [[2103, 12, 1], [2104, 3, 1], 4], 0.24863388], ['regression non-annual year choice 2', [[2084, 4, 30], [2085, 1, 30], 4], 0.753424658], ['partial repair probe 1', [[2000, 11, 14], [2001, 8, 14], 4], 0.747945205], ['partial repair probe 2', [[2072, 10, 28], [2073, 1, 28], 4], 0.252054795], ['boundary control 1', [[2024, 2, 29], [2025, 2, 28], 1], 1.0], ['boundary control 2', [[2023, 3, 1], [2024, 3, 1], 1], 1.0], ['normal control 1', [[2063, 3, 3], [2064, 3, 2], 1], 0.99726776], ['normal control 2', [[1906, 3, 6], [1906, 6, 6], 4], 0.252054795]], [['regression non-annual year choice 1', [[1947, 12, 30], [1948, 12, 30], 2], 1.0], ['regression non-annual year choice 2', [[2000, 3, 28], [2001, 9, 28], 2], 1.504109589], ['partial repair probe 1', [[2096, 1, 15], [2097, 7, 15], 2], 1.498630137], ['partial repair probe 2', [[2024, 12, 29], [2025, 3, 29], 4], 0.246575342], ['boundary control 1', [[2024, 2, 29], [2025, 2, 28], 1], 1.0], ['boundary control 2', [[2023, 3, 1], [2024, 3, 1], 1], 1.0], ['normal control 1', [[2004, 2, 28], [2004, 11, 7], 1], 0.691256831], ['normal control 2', [[1982, 2, 24], [1983, 2, 24], 1], 1.0]], [['regression non-annual year choice 1', [[1927, 7, 23], [1928, 4, 23], 4], 0.75136612], ['regression non-annual year choice 2', [[2044, 11, 4], [2045, 5, 4], 2], 0.495890411], ['partial repair probe 1', [[2024, 11, 15], [2025, 2, 15], 4], 0.252054795], ['partial repair probe 2', [[2028, 7, 31], [2029, 6, 7], 4], 0.852054795], ['boundary control 1', [[2024, 2, 29], [2025, 2, 28], 1], 1.0], ['boundary control 2', [[2023, 3, 1], [2024, 3, 1], 1], 1.0], ['normal control 1', [[2095, 3, 28], [2097, 3, 28], 1], 1.99726776], ['normal control 2', [[2069, 3, 7], [2070, 3, 7], 1], 1.0]]]
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 non-annual year choice 10.2459016390.246575342Failed
regression non-annual year choice 20.7459016390.747945205Failed
partial repair probe 10.3251366120.326027397Failed
partial repair probe 20.2459016390.246575342Failed
boundary control 11.01.0Passed
boundary control 21.01.0Passed
normal control 10.1178082190.117808219Passed
normal control 20.497267760.49726776Passed

SHA-256 / 7e27407492e1c5c1039fdf652cd8758322727ebe024e3cfd6d6e510d035521b3

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, freq):
    A = datetime.date(*a)
    B = datetime.date(*b)
    def leap(y):
        return (y % 4 == 0 and y % 100 != 0) or y % 400 == 0
    days = (B - A).days
    if freq == 1:
        has29 = any(leap(y) and A < datetime.date(y, 2, 29) <= B for y in range(A.year, B.year + 1))
        den = 366 if has29 else 365
    else:
        den = 366 if leap(A.year) or leap(B.year) else 365
    return round(days / den, 9)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression non-annual year choice 1', [[2096, 12, 15], [2097, 3, 15], 4], 0.246575342], ['regression non-annual year choice 2', [[1916, 10, 19], [1917, 7, 19], 4], 0.747945205], ['partial repair probe 1', [[1908, 11, 30], [1909, 3, 29], 2], 0.326027397], ['partial repair probe 2', [[2000, 12, 29], [2001, 3, 29], 4], 0.246575342], ['boundary control 1', [[2023, 3, 1], [2024, 3, 1], 1], 1.0], ['boundary control 2', [[2023, 2, 28], [2024, 2, 29], 1], 1.0], ['normal control 1', [[2103, 1, 29], [2103, 3, 13], 1], 0.117808219], ['normal control 2', [[2096, 1, 29], [2096, 7, 29], 2], 0.49726776]], [['regression non-annual year choice 1', [[1999, 12, 15], [2000, 3, 15], 4], 0.24863388], ['regression non-annual year choice 2', [[2012, 3, 18], [2013, 4, 12], 2], 1.068493151], ['partial repair probe 1', [[2096, 3, 29], [2097, 1, 3], 4], 0.767123288], ['partial repair probe 2', [[2080, 5, 1], [2081, 2, 1], 4], 0.756164384], ['boundary control 1', [[2023, 3, 1], [2024, 3, 1], 1], 1.0], ['boundary control 2', [[2023, 2, 28], [2024, 2, 29], 1], 1.0], ['normal control 1', [[1912, 6, 19], [1913, 6, 19], 1], 1.0], ['normal control 2', [[1963, 9, 30], [1964, 9, 30], 1], 1.0]], [['regression non-annual year choice 1', [[2103, 12, 1], [2104, 3, 1], 4], 0.24863388], ['regression non-annual year choice 2', [[2084, 4, 30], [2085, 1, 30], 4], 0.753424658], ['partial repair probe 1', [[2000, 11, 14], [2001, 8, 14], 4], 0.747945205], ['partial repair probe 2', [[2072, 10, 28], [2073, 1, 28], 4], 0.252054795], ['boundary control 1', [[2024, 2, 29], [2025, 2, 28], 1], 1.0], ['boundary control 2', [[2023, 3, 1], [2024, 3, 1], 1], 1.0], ['normal control 1', [[2063, 3, 3], [2064, 3, 2], 1], 0.99726776], ['normal control 2', [[1906, 3, 6], [1906, 6, 6], 4], 0.252054795]], [['regression non-annual year choice 1', [[1947, 12, 30], [1948, 12, 30], 2], 1.0], ['regression non-annual year choice 2', [[2000, 3, 28], [2001, 9, 28], 2], 1.504109589], ['partial repair probe 1', [[2096, 1, 15], [2097, 7, 15], 2], 1.498630137], ['partial repair probe 2', [[2024, 12, 29], [2025, 3, 29], 4], 0.246575342], ['boundary control 1', [[2024, 2, 29], [2025, 2, 28], 1], 1.0], ['boundary control 2', [[2023, 3, 1], [2024, 3, 1], 1], 1.0], ['normal control 1', [[2004, 2, 28], [2004, 11, 7], 1], 0.691256831], ['normal control 2', [[1982, 2, 24], [1983, 2, 24], 1], 1.0]], [['regression non-annual year choice 1', [[1927, 7, 23], [1928, 4, 23], 4], 0.75136612], ['regression non-annual year choice 2', [[2044, 11, 4], [2045, 5, 4], 2], 0.495890411], ['partial repair probe 1', [[2024, 11, 15], [2025, 2, 15], 4], 0.252054795], ['partial repair probe 2', [[2028, 7, 31], [2029, 6, 7], 4], 0.852054795], ['boundary control 1', [[2024, 2, 29], [2025, 2, 28], 1], 1.0], ['boundary control 2', [[2023, 3, 1], [2024, 3, 1], 1], 1.0], ['normal control 1', [[2095, 3, 28], [2097, 3, 28], 1], 1.99726776], ['normal control 2', [[2069, 3, 7], [2070, 3, 7], 1], 1.0]]]
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 non-annual year choice 10.2459016390.246575342Failed
regression non-annual year choice 20.7459016390.747945205Failed
partial repair probe 10.3251366120.326027397Failed
partial repair probe 20.2459016390.246575342Failed
boundary control 11.01.0Passed
boundary control 21.01.0Passed
normal control 10.1178082190.117808219Passed
normal control 20.497267760.49726776Passed

SHA-256 / 571e20d8cd76e504e8e4fa077b66453765bd424aac97733e4a1f4647e6bbc9a9

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

Case digest / 1a8ae2c7b72ffbf1f88faedf3c91d71d5a7df725375f5c75ad97714073fe2795