-
Add the dependency to your
shard.yml
:dependencies: eeeval: github: eltony81/easy_expression_eval
-
Run
shards install
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
- Fork it (https://github.com/your-github-user/eeeval/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
- eltony81 - creator and maintainer