diff --git a/README.md b/README.md index 059af8a..6b4cca2 100644 --- a/README.md +++ b/README.md @@ -119,6 +119,22 @@ parser.eval_equation('hoursdiff("2018-01-01", "2018-01-02")') # resu parser.eval_equation('hoursdiff("2019-02-01T08:00", "2019-02-01T12:00")') # result => 4 parser.eval_equation('hoursdiff("2019-02-01T08:20", "2019-02-01T12:00")') # result => 3.67 parser.eval_equation('hoursdiff("2018-01-01", "2018-01-01")') # result => 0 + +# Calculate a string as an equation +parser.eval_equation('calculate("2+2+2*4)"') # result => "12" +parser.eval_equation('calculate("(2+2)*4)"') # result => "16" +parser.eval_equation('calculate("2^4)"') # result => "16" +parser.eval_equation('calculate("sqrt(9))"') # result => "3" +parser.eval_equation('calculate("abs(-50))"') # result => "50" +parser.eval_equation('calculate("round(1.123))"') # result => "1" +parser.eval_equation('calculate("add_days(\"2019-01-01\", 3))"') # result => "2019-01-04" +parser.eval_equation('calculate("daysdiff(\"2019-01-01\", \"2019-01-02\"))"') # result => "1" +parser.eval_equation('calculate("hoursdiff(\"2019-01-01\", \"2019-01-02\"))"') # result => "24" +parser.eval_equation('calculate("3 > 2 ? \"higher\" : \"lower\")"') # result => "higher" +parser.eval_equation('calculate("3 < 2 ? \"higher\" : \"lower\")"') # result => "lower" +parser.eval_equation('calculate("concat(\"One \", concat(\"Two\", \" Three\")))"') # result => "One Two Three" +parser.eval_equation('calculate("\"One\" // \" \" // \"Two\" // \" \" // \"Three\")"') # result => "One Two Three" +parser.eval_equation('calculate("number(calculate(\"1 + 1\")) + 1)"') # result => "3") ``` ### The following functions can be used diff --git a/ext/libnativemath/libnativemath.bundle b/ext/libnativemath/libnativemath.bundle index c80d08b..9343665 100755 Binary files a/ext/libnativemath/libnativemath.bundle and b/ext/libnativemath/libnativemath.bundle differ diff --git a/ext/libnativemath/mkmf.log b/ext/libnativemath/mkmf.log new file mode 100644 index 0000000..b718086 --- /dev/null +++ b/ext/libnativemath/mkmf.log @@ -0,0 +1,8 @@ +find_executable: checking for cmake... -------------------- yes + +-------------------- + +find_executable: checking for swig... -------------------- yes + +-------------------- + diff --git a/mkmf.log b/mkmf.log new file mode 100644 index 0000000..b718086 --- /dev/null +++ b/mkmf.log @@ -0,0 +1,8 @@ +find_executable: checking for cmake... -------------------- yes + +-------------------- + +find_executable: checking for swig... -------------------- yes + +-------------------- +