Skip to content

eltony81/easy_expression_eval

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Easy Expression Eval (eeeval)

GitHub release (latest SemVer) GitHub Workflow Status


Installation

  1. Add the dependency to your shard.yml:

    dependencies:
      eeeval:
        github: eltony81/easy_expression_eval
  2. Run shards install

Usage

require "eeeval"

expression = "(14.2 + 14.2) * 4 / 2 * 10.5 ^ (2 / 0.5) + sin(2^1+cos(2+7.9-6))"
result = EEEval::CalcFuncParser.evaluate(expression)
puts result

Note: the current implementation does support log exp sin cos sqrt tan atan asin acos exp2 log10 log2 functions

Contributing

  1. Fork it (https://github.com/your-github-user/eeeval/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors