mirror of
https://github.com/nushell/nushell
synced 2025-01-07 10:49:03 +00:00
9bc4e6794d
Reasoning: Most missing math commands are implemented with #7258. The `meval` crate itself declares that it doesn't strive to stringent standards (https://docs.rs/meval/latest/meval/#related-projects). For example no particular special casing or transformations are performed to ensure numerical stability. It uses the same rust `std` library functions we use or have access to (and `f64`). While the command call syntax in nushell may be a bit more verbose, having a single source of truth and common commands is beneficial. Furthermore the `math` commands can themselves implement broadcasting over lists (or table columns). Closes #7073 Removed dependencies: - `meval` - `nom 1.2.4` (duplicate) User-Facing Changes: Scripts using `math eval` will break. We remove a further `eval` like behavior to get results through runtime evaluation (albeit limited in scope) Tests: - Updated tests that internally used `math eval`. - Removed one test that primarily used `math eval` to obtain a result from `str join`
71 lines
1.6 KiB
Rust
71 lines
1.6 KiB
Rust
mod abs;
|
|
mod arccos;
|
|
mod arccosh;
|
|
mod arcsin;
|
|
mod arcsinh;
|
|
mod arctan;
|
|
mod arctanh;
|
|
mod avg;
|
|
mod ceil;
|
|
mod cos;
|
|
mod cosh;
|
|
mod euler;
|
|
mod floor;
|
|
mod ln;
|
|
mod log;
|
|
pub mod math_;
|
|
mod max;
|
|
mod median;
|
|
mod min;
|
|
mod mode;
|
|
mod pi;
|
|
mod product;
|
|
mod reducers;
|
|
mod round;
|
|
mod sin;
|
|
mod sinh;
|
|
mod sqrt;
|
|
mod stddev;
|
|
mod sum;
|
|
mod tan;
|
|
mod tanh;
|
|
mod tau;
|
|
mod utils;
|
|
mod variance;
|
|
|
|
pub use abs::SubCommand as MathAbs;
|
|
pub use avg::SubCommand as MathAvg;
|
|
pub use ceil::SubCommand as MathCeil;
|
|
pub use floor::SubCommand as MathFloor;
|
|
pub use math_::MathCommand as Math;
|
|
pub use max::SubCommand as MathMax;
|
|
pub use median::SubCommand as MathMedian;
|
|
pub use min::SubCommand as MathMin;
|
|
pub use mode::SubCommand as MathMode;
|
|
pub use product::SubCommand as MathProduct;
|
|
pub use round::SubCommand as MathRound;
|
|
pub use sqrt::SubCommand as MathSqrt;
|
|
pub use stddev::SubCommand as MathStddev;
|
|
pub use sum::SubCommand as MathSum;
|
|
pub use variance::SubCommand as MathVariance;
|
|
|
|
pub use cos::SubCommand as MathCos;
|
|
pub use cosh::SubCommand as MathCosH;
|
|
pub use sin::SubCommand as MathSin;
|
|
pub use sinh::SubCommand as MathSinH;
|
|
pub use tan::SubCommand as MathTan;
|
|
pub use tanh::SubCommand as MathTanH;
|
|
|
|
pub use arccos::SubCommand as MathArcCos;
|
|
pub use arccosh::SubCommand as MathArcCosH;
|
|
pub use arcsin::SubCommand as MathArcSin;
|
|
pub use arcsinh::SubCommand as MathArcSinH;
|
|
pub use arctan::SubCommand as MathArcTan;
|
|
pub use arctanh::SubCommand as MathArcTanH;
|
|
|
|
pub use euler::SubCommand as MathEuler;
|
|
pub use pi::SubCommand as MathPi;
|
|
pub use tau::SubCommand as MathTau;
|
|
|
|
pub use self::log::SubCommand as MathLog;
|
|
pub use ln::SubCommand as MathLn;
|