Project

evaluator

0.0
No commit activity in last 3 years
No release in over 3 years
Mathematical expression evaluator for infix notation
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
 Dependencies

Development

>= 0
>= 0
>= 0
 Project Readme

README

Evaluator is a mathematical expression evaluator for infix notation. It supports variables and functions.

Build Status Code Climate

Usage

require 'evaluator'
puts Evaluator('1+1')
puts Evaluator('sin pi')

See the test cases for more examples.

Calculator

A small calculator program (calc.rb) is provided with this library. You can use it as follows:

$ ./calc.rb
> number := 10
10
> number * 3
30
> 1 [joule] in [MeV]
6241509647120.42 MeV

The calculator loads a few natural constants at startup (calc.startup). For unit support my unit gem is used. Units are denoted in brackets e.g. [meter], [kV] etc

Authors

Daniel Mendler