You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Confusing error when raising an integer to a negative power #15860
When an integer is raised by a negative power an operator overflow error is thrown, which I think is off. It should probably be a value error instead.
How to reproduce
~>10**-1Error:nu::shell::operator_overflow×Operatoroverflow.╭─[entry#90:1:4]1│10**-1·─┬·╰──powoperationoverflowed╰────help:Considerusingfloatingpointvaluesforincreasedrangebypromotingoperandwith'into float'.Note:floathasreducedprecision!~>10**-1.0# works fine0.1~>10.0**-1# also works fine0.1
Expected behavior
I expected Nushell to throw a value error. Probably "unsupported input" like math ln does when its passed a negative number.
Configuration
key
value
version
0.104.1
major
0
minor
104
patch
1
branch
commit_hash
build_os
linux-x86_64
build_target
x86_64-alpine-linux-musl
rust_version
rustc 1.87.0 (17067e9ac 2025-05-09) (Alpine Linux 1.87.0-r0)
cargo_version
cargo 1.87.0 (99624be96 2025-05-06) (Alpine Linux 1.87.0-r0)
changed the title [-]Confusing numerical error when raising an integer to a negative power[/-][+]Confusing error when raising an integer to a negative power[/+]on May 31, 2025
Activity
[-]Confusing numerical error when raising an integer to a negative power[/-][+]Confusing error when raising an integer to a negative power[/+]Better error handling for negative integer exponents in ** operator (n…
Better error handling for negative integer exponents in ** operator (n…
Better error handling for negative integer exponents in ** operator (n…
Better error handling for negative integer exponents in ** operator (n…