Skip to content

Remove math eval and fully replace it with pure nushell implementation #7073

Closed

Description

@sholderbach

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

Activity

  1. webbedspace commented on Nov 10, 2022

    @webbedspace
    Contributor

    Agree.

  2. added
    help wanted
    good first issue
    on Nov 22, 2022
  3. pinned this issue on Nov 22, 2022
  4. unpinned this issue on Dec 2, 2022
  5. pinned this issue on Dec 2, 2022
  6. added a commit that references this issue on Jan 4, 2023
    9bc4e67
  7. unpinned this issue on Jan 4, 2023
  8. added this to the v0.74 milestone on Jan 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    category:enhancementgood first issuehelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions