Skip to content

fix: preserve NL day-count additivity at leap-day boundaries - #76

Open
kadyrbekovhamit-cyber wants to merge 1 commit into
Anexen:mainfrom
kadyrbekovhamit-cyber:codex/fix-nl-day-count-leap-end
Open

fix: preserve NL day-count additivity at leap-day boundaries#76
kadyrbekovhamit-cyber wants to merge 1 commit into
Anexen:mainfrom
kadyrbekovhamit-cyber:codex/fix-nl-day-count-leap-end

Conversation

@kadyrbekovhamit-cyber

Copy link
Copy Markdown

Summary

  • treat February 29 at the start of an NL interval consistently with the existing (d1, d2] convention
  • prevent negative day counts for an empty leap-day interval
  • add boundary and additivity coverage for both NL/365 and NL/360

Problem

leap_days_between excluded February 29 from the end boundary, as established by the existing test_example_2::case_4, but did not exclude it from the start boundary. Therefore:

NL/365(2020-02-29, 2020-02-29) = -1 day
NL/365(2020-02-28, 2020-03-01) !=
  NL/365(2020-02-28, 2020-02-29) + NL/365(2020-02-29, 2020-03-01)

The change includes February 29 in the start-side adjustment (ordinal() >= 60) while deliberately retaining the current end-side < 60 comparison. This preserves the library's existing (d1, d2] financial interval convention.

Validation

  • cargo test --release --features nonumpy: 227 passed, 10 ignored
  • cargo fmt --check
  • mutation check: restoring the old start-boundary predicate makes the new regression test fail

Signed-off-by: kadyrbekovhamit-cyber <288885044+kadyrbekovhamit-cyber@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant