Repository navigation
feat: accept ranges in math trig and log commands - #19604
Conversation
Signed-off-by: Josue Barros <[email protected]>
There was a problem hiding this comment.
Review overview
🟡 Changes recommended
Ranges work in all 14 commands, including the float-step range from #19552 and --degrees, and a value out of domain still errors at the range. One thing to fix before merge: an unbounded range like 0.. streams forever here, where math sqrt and the other math commands reject it. The other two are an example and a release note.
Findings: 0
Open (3)
Notes from my clanker, checked on 43dc87f. Built the branch, ran cargo test -p nu-cmd-extra --lib -- math:: (17 passed), clippy with CI's flags, fmt and typos (all clean), and ran each case on the branch binary and on 0.117.1.
Signed-off-by: Josue Barros <[email protected]>
|
Addressed all three review points: added the shared |
There was a problem hiding this comment.
Review overview
🟡 Changes recommended
Two of the three threads are fixed and resolved. All 14 commands now reject 0.. with the same error as math sqrt, and the release note is in. Two things are left. The new exp example fails clippy, and I reopened the examples thread because math ln still has no range example. The 1..3 example I suggested there hits the same lint, since clippy reads 0.6931 as LN_2. 1..3..5 | math ln | math round --precision 4 gives [0.0, 1.0986, 1.6094] and passes clippy and test_examples.
Findings: 0
Notes from my clanker, checked on 32c9095. Built the branch, ran cargo test -p nu-cmd-extra --lib -- math:: (18 passed), clippy with CI's flags (1 error), fmt and typos (clean), and ran 0.. | math <cmd> for all 14 commands on the branch binary and on 0.117.1.
|
please follow the PR template. your headers are wrong. we use the release template information to make release notes |
|
Implicitly converting bounded ranges to lists is still a better idea imo, because this way it also works for user-defined commands |
Agreed but it's not for this PR. |
|
Updated the PR body to the repository template, with the release note under User-facing changes (Release notes). |
|
Thanks |



Description
Adds
Type::Rangeto the input signatures ofmath sin/cos/tan, their inverse and hyperbolic variants,math ln, andmath exp. The existingPipelineData::mappath already handles ranges; only the signature blocked parsing.Tests cover
0..10for sin/exp and1..10for ln.cargo test -p nu-cmd-extra math::passes; CodeRabbit reports 0 findings.User-facing changes (Release notes)
math sin,math cos,math tan, their inverse and hyperbolic versions,math ln, andmath expnow accept ranges. For example,0..0.1..1 | math sinworks without converting the range to a list first. Unbounded ranges are still rejected, matchingmath sqrt.Additional notes
Fixes #19552.