Command CALC
Function:
Perform basic arithmetic calculations in a batch program. The result is either displayed or stored in an environment variable called CALC.
Syntax:
CALC [?] expr
| ? | Display the result only. Does not set the environment variable. |
| expr | Sequence of tokens, that can include the following :-
| + | Addition |
| - | Subtraction |
| * | Multiplication |
| / or \ | Division |
| % | Remainder or modulus |
| ~ | Bitwise NOT |
| ^ | Bitwise XOR |
| & | Bitwise AND |
| | | Bitwise OR |
| << | Left bit shift |
| >> | Right bit shift |
| && | Logical AND |
| || | Logical OR |
| ! | Logical NOT |
| < | Boolean less then |
| > | Boolean greater then |
| <= | Boolean less then or equal to |
| >= | Boolean greater then or equal to |
| == | Boolean equal to |
| != | Boolean not equal to |
| ( | Left bracket |
| ) | right bracket |
| numbers | Either integer or real numbers |
| strings | Sequence of characters |
| functions | Scientific functions |
|
Warning
- When using tokens that include characters that have a special meaning (eg. <, >, & etc) then enclose the complete expr in brackets, as follows :-
CALC [?] ( expr )
- When in doubt, use the above syntax.
Note:
- The normal operator precedence is assumed, unless the left and right brackets are used to over-ride the default precedence.
- Examples on using CALC.
- Also see command LET and Batch Programs.
|