You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|Noccy 2c6496f708||6 months ago|
|bin||1 year ago|
|src||6 months ago|
|.gitignore||1 year ago|
|README.md||1 year ago|
|composer.json||1 year ago|
The CLI calculator you never knew you needed. Also usable as a library!
Call with an expression to evaluate:
$ calc "42*atan(pi/2)" 42.163162517863
Or call without arguments to go interactive:
$ calc ~ 42*atan(pi/2) 42.163162517863
As simple as falling off a rock:
use NoccyLabs\PhpCalc\Calculator; $calc = new Calculator(); $result = $calc->evaluate("42 * atan(pi/2)");
What it does
^exponent/raise to power
- You can set the precision using the
_pvariable. If the expression is passed on the command line, prepend the variable followed by a semicolon, such as
_p=2;pifor the result 3.14.
Bugs and known issues
- Negative numbers and subtraction should be surrounded by whitespace to parse properly.
2-1will result in
-1, returning 2 and a warning. Passing
2 - 1will return
1as expected, as will