aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorBruce Wells <brucekwells@gmail.com>2019-01-09 03:39:48 +0300
committerBruce Wells <brucekwells@gmail.com>2019-01-09 03:39:48 +0300
commit9684cfd1d0e61a6bfcf1a46f322f99e7b6559df5 (patch)
treeca4b36c1383276cf50e81791b4b6179e4cacacd7 /README.md
parent76307e3f41b5582196e9620c687052f8bb8537cc (diff)
parent8e9c8508cbfaa944505f7d3a988bcfce1e4d7bba (diff)
Merge branch 'master' of https://github.com/phpfui/MathExecutor
# Conflicts: # src/NXP/Classes/Lexer.php
Diffstat (limited to 'README.md')
-rw-r--r--README.md17
1 files changed, 9 insertions, 8 deletions
diff --git a/README.md b/README.md
index f5bf318..39490a4 100644
--- a/README.md
+++ b/README.md
@@ -3,18 +3,19 @@
A simple math expressions calculator
## Features:
-* Built in support for +, -, *, / and power (^) operators
+* Built in support for +, -, *, / and power (^) operators plus ()
* Support for user defined operators
* Support for user defined functions
-* Unlimited varable length
-* String support, as function parameters or as evaluated by PHP
+* Unlimited variable name lengths
+* String support, as function parameters or as evaluated as a number by PHP
* Exceptions on divide by zero, or treat as zero
-* Unary Minus
+* Unary Minus (e.g. -3)
+* Pi ($pi) and Euler's number ($e) support to 11 decimal places
## Install via Composer:
Stable branch
```
-composer require "nxp/math-executor" "dev-master"
+composer require "nxp/math-executor"
```
Dev branch (currently unsupported)
@@ -120,7 +121,7 @@ $pi = 3.14159265359
$e = 2.71828182846
```
-You can add own variable to executor:
+You can add your own variables to executor:
```php
$executor->setVars([
@@ -131,7 +132,7 @@ $executor->setVars([
echo $executor->execute("$var1 + $var2");
```
## Division By Zero Support:
-By default, the result of division by zero is zero and no error is generated. You have the option to thow a \NXP\Exception\DivisionByZeroException by by calling setDivisionByZeroException.
+By default, the result of division by zero is zero and no error is generated. You have the option to thow a \NXP\Exception\DivisionByZeroException by calling setDivisionByZeroException.
```php
$executor->setDivisionByZeroException();
@@ -146,7 +147,7 @@ try {
Negative numbers are supported via the unary minus operator, but need to have a space before the minus sign. `-1+ -3` is legal, while '`-1+-3` will produce an error due to the way the parser works. Positive numbers are not explicitly supported as unsigned numbers are assumed positive.
## String Support:
-Expressions can contain double or single quoted strings that are evaluated the same way as PHP. You can also pass strings to functions.
+Expressions can contain double or single quoted strings that are evaluated the same way as PHP evalutes strings as numbers. You can also pass strings to functions.
```php
echo $executor->execute("1 + '2.5' * '.5' + myFunction('category')");