e is an evaluator for arithmetic expressions like 3*log(pi+10!)
,
It doesn't need bison or anything else other than a C compiler. In fact it is a recursive descent parser with one character lookahead.
e's author is Apostolos Dimitromanolakis. Later, some idiot named Casey found it and put it on github.
Read the questions at the bottom!
First of all you can use '[' instead of '(' and ']' instead of ')'. This is to avoid using quotes when writing an expression at the command line. For example, instead of:
$ e '5*log(2+3)'
you can use the following (which is 2 keystrokes and 2 shifts shorter):
$ e 5*log[2+3]
You can also omit the parenthesis of a function, for example:
$ e log1+log2+log3
Finally you can use the usual notation 5e7 = 5 * 10^7.
Ok, now what is available...
operators explanation evaluation precedence
--------- ----------- ---------- ----------
+ - add,subtract left to right lower
* / % multiply, divide, modulo left to right
^ exponentiate right to left
! factorial obvious higher
constants
---------
e 2.7182818284590452...
pi 3.14159265358979....
functions explanation
--------- ----------
abs, fabs absolute value
floor, ceil, sqrt, exp like <math.h>
sin, cos, tan like <math.h>
sinh, cosh, tanh like <math.h>
asin, acos, atan like <math.h>
asinh, acosh, atanh like <math.h>
ln natural logarithm (base e)
log base 2 logarithm (log256 = 8)
Read the next question.
Have you ever wondered why +5 is a valid expression and 5+ isn't? Read the next question.
Read on...
Pause for a moment and think.. Ok so, deep in the mathematical universe, there are...
9000 4 digit numbers (from 1000 to 9999)
900 3 digit numbers (from 100 to 999)
90 2 digit numbers (from 10 to 99)
Therefore you should have guessed that we have...
9 1 digit numbers (from 1 to 9)
It is a 0-digit number! That means you don't have to write anything when you want 0. Writing '0' for 0 is like writing '04' for 4.
So when we write:
+
it is equivalent to:
0+0
I hope everything is clear now! (for example e^ = e^0 = 1)