Skip to content

A safe and simple math evaluator for Rust and Python.

License

Notifications You must be signed in to change notification settings

Cryptex-github/expr.rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

expr.rs

A safe and simple math evaluator for Rust.

Rust rewrite of expr.py

Features

Basic operations such as

  • addition
  • subtraction
  • multiplication
  • division
  • modulo
  • exponentiation
  • negation
  • factorial

are supported

Features like sin, cos, tan, log, and more are planned for the future.

A python interface is also planned for the future.

Usage

use expr_rs::parser;

assert_eq!(parser::eval("1 + 2").unwrap().to_string(), "3");

In Python

import expr_rs

assert expr_rs.eval("1 + 2") == 3

In CLI

cargo install expr_rs

expr 1 + 2

About

A safe and simple math evaluator for Rust and Python.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published