#expression-evaluator #numbers #basic #operator #sin #tan

bt_math

Basic math expression evaluator library. Support basic math operators (+,-,*,/,^), parenthesis, and functions such as log10, ln, log2, exp, sin, cos, tan, asin, acos, atan, abs, sqrt. Support PI and E (Euler's number) as constants. Support negative numbers/expressions

3 unstable releases

new 0.2.1 Jan 17, 2025
0.2.0 Jan 17, 2025
0.1.0 Nov 19, 2024

#475 in Math

GPL-3.0-only

13KB
189 lines

Project Title

BT MATH

Description

A simple implementation of an expression evaluator that can handle basic arithmetic operations, parentheses, and some mathematical functions that provide a way to evaluate mathematical expressions using RPN (Reverse Polish Notation) implemented in two parts: parsing and evaluation.

Support the use of PI and E (Euler's number), negative numbers or expressions, and the following functions: ln, log2, exp (e^#), asin, acos, atan, sin, cos. tan. abs, sqrt. log10

Usage

let expression = "2 + 3 * 4";
 .......
let f = evaluate_expression(expression).unwrap();

Version History

  • 0.1.0
    • Initial Release
  • 0.2.0
    • Added PI and E (Euler's number) support. Support for negative numbers. Fix error with log (log was removed) and added log10.

License

GPL-3.0-only

Dependencies

~2.2–3MB
~54K SLoC