-
Notifications
You must be signed in to change notification settings - Fork 42
Calculator
Paul edited this page Dec 15, 2015
·
4 revisions
calc
More than just a calculator. It supports variables and user defined macros!
The expression comes after the word calc
... Do not expect a prompting screen to popup!
Here will be examples of what you can do:
calc 10:a
In this case, a
is assigned to the value 10
. Note that variables can be [a-zA-Z]
. Think you got the hang of it?
Try to solve this:
calc (4:a)(a):a
Here is how macros work:
calc {/0}[guaranteed error]
In this case a macro called [guaranteed error]
is defined as /0
Here is how you would call the function:
[guaranteed error]
YOU WILL RECEIVE A DIVIDING BY ZERO MESSAGE!!!
An interesting fact about macros is that they can also be used as variables.
For example the variable Pi
and e
are used via calc [Pi]
operand | function |
---|
- | Addition
- | Minus
- | Multiply / | Division % | Remainder ^ | Bitwise xor & | Bitwise and | | Bitwise or << | Shift left
| Shift right $ | Unary rounding
Predefined Functions:
- sin
- cos
- tan
- cot
- sec
- csc
- floor
- ceil
- rand