iDevOS CALC "ABS" Command
Get the absolute value.
Description
CALC( y, a, "ABS" ); // y = abs(a) = absolute value of a
This command returns the value y
which is the absolute value of a
.
Parameters
y
- Calculation result.
Parameter type: entity name of a numeric variable (egU8
,S32
,FLT3
etc). a
- Input value.
Parameter type: immediate number, or entity name of a numeric variable (egU8
,S32
,FLT3
etc). "ABS"
- CALC command operator.
Parameter type: immediate string.
Examples
Example 1
CALC(d, -123, "ABS"); // d = 123
Example 2
VAR(d, 0, S32); VAR(a1, -49, S32); VAR(a2, 88, S32); CALC(d, a1, "ABS"); // d = 49 CALC(d, a2, "ABS"); // d = 88