-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Remove math eval and fully replace it with pure nushell implementation #7073
Copy link
Copy link
Closed
Labels
category:enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomershelp wantedstatus: Extra attention is neededstatus: Extra attention is needed
Milestone
Description
Related problem
We currently have math eval that takes a string and parses and executes math in it through the meval crate.
This creates two sources of truth how math behaves in nushell.
Further more the crate carries some out of date dependencies, causing dependency duplication.
Describe the solution you'd like
For nu to be a fully useable scripting language there should be a library of math functions that are implemented with proper care (may be part of the core or a plugin).
math eval shouldn't be necessary or trivially implementable in nu code.
Describe alternatives you've considered
Hot take: If you need string math bc is still around, but math eval is only slightly more compatible with nushell/
List of missing math commands:
Compare to https://docs.rs/meval/latest/meval/#supported-expressions
Exponentiation
-
pow/ general exponentiation -
exp, -
ln - logs in other bases for convenience/numerical stability reasons
Trigonometry
-
sin -
cos -
tan -
asin -
acos -
atan -
atan2 -
sinh -
cosh -
tanh -
asinh -
acosh -
atanh
Utilities
-
signum(get the sign cheaply) -
modulo
constants:
-
pi -
e
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
category:enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomershelp wantedstatus: Extra attention is neededstatus: Extra attention is needed