Command Line

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.
exprSequence 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
numbersEither integer or real numbers
stringsSequence of characters
functionsScientific 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.

Copyright © 1995-2005 Lucien Cinc, All Rights Reserved
WinOne is an Australian registered trademark of Lucien Cinc