/rust-calculator

Calculator in rust

Primary LanguageRust

Features

  • Addition/Subtraction

    • Unary minus
  • Multiplication/Division

    • Assume multiplication when two operands are adjacent e.g. (3)(4) = 3(4) = 12, 2pi = tau
    • Unary % (/100)
  • Braces

    • Basic
    • Nested
    • Match checking
    • Completion/Correction
  • Powers

    • Real
    • Complex (Uses num crate)
  • Roots

    • Unary square root √x (without 2√x)
  • Functions

    • Trigonometry
  • Constants (in f64 context)

  • Multidimensional

    • Complex numbers
    • Vectors
    • Matrices
  • Expression entry

    • Ignore whitespace
    • Show corrected brackets
  • CLI Terminal mode

    • Basic
    • History
    • Clear history
    • Help
    • Colors
    • Completion
    • Memory
      • Variables
      • User functions

TODO

  • After calc, ensure stack is exactly 1
  • Errors
    • Token parse error
    • Mismatched brackets
    • Stack size

Errors

  • Complex:
    • (0-1)^0.5 = 1 (should be i)