Repository navigation
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Merges the zcode-pr-transfer branch (61 commits transferring open, not-yet-merged upstream PRs into our fork) into main. Docs (docs/ui-parity.md, docs/file-format-parity.md) resolved in favor of main's current changelog state; code from all transferred PRs carried over cleanly. Commits carried over (21 from this session + 40 earlier transfers): storytold#4408, storytold#4405, storytold#4406, storytold#4386, storytold#4379, storytold#4378, storytold#4376, storytold#4375, storytold#4373, storytold#4370, storytold#4369, storytold#4348, storytold#4347, storytold#4345, storytold#4344, storytold#4343, storytold#4341, storytold#4340, storytold#4337, storytold#4336, storytold#4318, storytold#4316, storytold#4315, storytold#4312, storytold#4310, storytold#4307, storytold#4306, storytold#4305, storytold#4303, storytold#4298, storytold#4295, storytold#4287, storytold#4286, storytold#4257, storytold#4256, storytold#4254, storytold#4252, storytold#4251, storytold#4248, storytold#4244, storytold#4243, storytold#4229, storytold#4228, storytold#4227, storytold#4225, storytold#4221, storytold#4220, storytold#4219, storytold#4217, storytold#4424, storytold#4423, storytold#4420, storytold#4419, storytold#4418, storytold#4414, storytold#3617, storytold#2642, storytold#2556, storytold#2321
Fixes #4094
Root cause
yieldmatincrates/functions/src/financial/securities.rs:186returned#NUM!whenever the settlement-to-maturity year fraction (dsm) was zero.mat_terms(line 170) already rejectssettlement >= maturity, sodsm == 0only happens when two distinct dates fall on the same 30/360 day. Examples are Jan 30 → Jan 31 under basis 4, or May 30 → May 31 under basis 0. In those cases Excel returns 0, as shown in the issue.Fix
The
pr <= 0check still returns#NUM!. Whendsm == 0, YIELDMAT now returns0instead of dividing by zero. Nothing else changes. Equal settlement and maturity dates are still rejected inmat_terms.Relation to #4154
#4154 (for #4093) changes how PRICEMAT/YIELDMAT count 30/360 days from the issue date. This change does not touch the day count. It only changes the branch in
yieldmatthat runs afterdsmhas been computed, so the two should not conflict beyond nearby lines. If #4154 lands first, thedsm == 0branch still applies. The issue's cases depend only on the settlement-to-maturity count, and that is zero either way.Tests
New test
financial::tests::yieldmat_zero_30_360_days_is_zeroincrates/functions/src/financial/tests.rs:#NUM!Without the fix (on upstream/main, and again with only the fix reverted):
With the fix:
Checks run
cargo fmt -p gridcraft-functions --check: clean (only changed lines)cargo clippy -j 4 -p gridcraft-functions --all-targets -- -D warnings: cleancargo test -j 4 -p gridcraft-functions: 182 passed, 0 failedNot run
cargo xtask ci(wasm, layers, assets, other crates). This needs CI.Summary by CodeRabbit
#NUM!.