Repository navigation
Conversation
Excel returns the rank's error when both the data and the rank hold one. Fixes storytold#4278.
|
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 #4278
What was wrong
largeandsmallincrates/functions/src/stat/descriptive.rsread the data (arg_nums(a, 0)?) before the rank (num(a, 1)?). When both held an error, the data's error came back first. Native Excel returns the rank's error, as the issue shows in both orders.What changed
LARGE and SMALL read the rank first, then the data. The ranking itself doesn't change. AGGREGATE 14/15 has its own argument handling (#4277) and isn't touched.
QA report
Main vs branch, end to end (
gridcraft-cli run, real cells)This is the issue's setup, built with
cell.set, printed, saved to.xlsx, reopened withgridcraft-cli cat.mainis agridcraft-clibuilt fromorigin/main(19f07f3a); the branch is this PR (69a69ab0). The Excel column is the issue's native Excel 16.0 result; I didn't run Excel myself.Setup:
A1:A4= 10, 20,=NA(), 40C1:C4= 10, 20,=1/0, 40 (the issue's swap)D1:D4= 10, 20, 30, 40E1==1/0,E2==NA(),E3= 2,E4=="x"=LARGE(A1:A4,E1)=SMALL(A1:A4,E1)=LARGE(C1:C4,E2)(swapped)=SMALL(C1:C4,E2)(swapped)=LARGE(A1:A4,E3)(only the data error)=SMALL(D1:D4,E1)(only the rank error)=LARGE(D1:D4,E3)(no error)=SMALL(A1:A4,E4)(text rank, data error)=AGGREGATE(14,6,A1:A4,E3)(untouched)Both builds reopened their saved workbook with the same nine values.
gridcraft-cli checkon the branch's file: 14 formula cells, 14 matched, round trip 0 of 1 files differ.Test
stat::tests::large_and_small_return_the_rank_error_before_a_data_errorchecks both functions in both orders, with only a data error, with only a rank error, and with no error.Negative control
With
descriptive.rsfromorigin/mainand the new test kept (on top of69a69ab0, then restored withgit checkout), the test fails: leftError(NA), rightError(Div0).Gate (macOS arm64)
cargo fmt --all -- --checkcargo clippy -p gridcraft-functions --all-targets -- -D warningscargo test -p gridcraft-functions -p gridcraft-engineNot covered
#VALUE!, by the same rule. The issue measured only two error values.kthhelper for SMALL rounds valid fractional ranks up, and LARGE/SMALL accept ranks below one #4275. It touches different lines in the same file, and both add a test tostat/tests.rsat different places.cargo xtask ci: I didn't run the fullcargo xtask ci(wasm, layers, the other crates).Summary by CodeRabbit
LARGEandSMALLnow report an invalid rank before an error in the data argument when both inputs are invalid. When only one input is invalid, its error is reported as before.