Help >
Arithmetic Functions
Version
7.11
Arithmetic Functions
abs(arg) Absolute value of arg.
exp(arg) Exponential eof arg (where e=2.7182818).
log(arg) Log base eof arg.
log10 (arg) Log base 10 of arg.
sqrt(arg) Square root of arg.
mod(arg1;arg2) Remainder of arg1 devided by arg2.
max(arg1;arg2) Maximum of arg1, arg2.
min(arg1;arg2) Minimum of aeg1, arg2.
int(arg) Results in the integer portion of arg.
numval(string) Convert a string variable to a numeric variable.
strlen(string) Number of characters in the string.
round(arg;n) Round result at specified (n) decimal position. If "n"
is negative, you are rounding in UNITS positions. For
example, n=-2 specifies rounding to the nearest
hundred.
Examples:
calc %aa=((sqrt(%xx * %yy)/%zz)+3)^2
if %xx=8 and %yy=2 and %zz=2, then %aa=25. That
works out as follows: 8 times 2 is 16, the sqrt of 16
is 4, 4 divided by 2 is 2, 2 plus 3 is 5, and 5 squared
is 25.
calc %aa=int(%xx)
If %xx=1.234 then %aa is 1.000.
calc %aa=strlen(%qq)
if %qq is the string "abcde" then %aa=5, the number
of characters in the string.
calc %aa=mod(%xx;10)
if %xx=107, then %aa=7
calc %aa=round(33/5.123;3)
33/5.123 produces the value 6.4415381612...
Since rounding was specified in the 3rd position,
this calculation produces %aa=6.4420000.
Numeric variables are always carried with full precision in calculations. But when you use the "value of" notation {} in order to substitute them into other commands or statements, a default precision of two decimal places is assumed. You can override this assumption as the TYPEs below illustrate:
calc %x=1.2345678 -%x becomes 1.2345678
type The value of %x is {%x} -You will see: The value of %x is 1.23
type {%x(.4)} -You will see: 1.2346 (note the rounding)
calc %b=%x+.0000001 -%b becomes 1.2345679
type {%b(.7)} -You will see: 1.2345679
Copyright © 2019 , WhamTech, Inc. All rights reserved. This
document is provided for information purposes only and the contents hereof are
subject to change without notice. Names may be
trademarks of their respective owners.