iDevOS CALC Basic Commands
Basic mathematical commands.
Description
Increment and Decrement
CALC( y, "++" ); // y = y + 1 = y incremented by 1 CALC( y, "--" ); // y = y - 1 = y decremented by 1 CALC( y, a, "++" ); // y = a + 1 = a incremented by 1 CALC( y, a, "--" ); // y = a - 1 = a decremented by 1
Addition, Subtraction, Multiplication, Division and Modulus
CALC( y, a, b, "+" ); // y = a + b = a added to b CALC( y, a, b, "-" ); // y = a - b = a subtracted by b CALC( y, a, b, "*" ); // y = a * b = a multiplied by b CALC( y, a, b, "/" ); // y = a / b = a divided by b CALC( y, a, b, "%" ); // y = a % b = a modulus b
Bitwise AND, OR, XOR and Shifting
CALC( y, a, b, "&" ); // y = a & b = a bitwise AND b CALC( y, a, b, "|" ); // y = a | b = a bitwise OR b CALC( y, a, b, "^" ); // y = a ^ b = a bitwise XOR b CALC( y, a, b, "<" ); // y = a << b = a bit shifted left by b CALC( y, a, b, ">" ); // y = a >> b = a bit shifted right by b
Combinational
CALC( y, a, b, c, "/-" ); // y = ( a / b ) - c = a divided by b then subtracted by c CALC( y, a, b, c, "/+" ); // y = ( a / b ) + c = a divided by b then added to c CALC( y, a, b, c, "-/" ); // y = ( a - b ) / c = a subtracted by b then divided by c CALC( y, a, b, c, "+/" ); // y = ( a + b ) / c = a added to b then divided by c CALC( y, a, b, c, "*-" ); // y = ( a * b ) - c = a multiplied by b then subtracted by c CALC( y, a, b, c, "*+" ); // y = ( a * b ) + c = a multiplied by b then added to c CALC( y, a, b, c, "-*" ); // y = ( a - b ) * c = a subtracted by b then multiplied by c CALC( y, a, b, c, "+*" ); // y = ( a + b ) * c = a added to b then multiplied by c CALC( y, a, b, c, "%-" ); // y = ( a % b ) - c = a modulus b then subtracted by c CALC( y, a, b, c, "%+" ); // y = ( a % b ) + c = a modulus b then added to c CALC( y, a, b, c, "-%" ); // y = ( a - b ) % c = a subtracted by b then modulus by c CALC( y, a, b, c, "+%" ); // y = ( a + b ) % c = a added to b then modulus by c CALC( y, a, b, c, "++" ); // y = ( a + b ) + c = a added to b then added to c CALC( y, a, b, c, "+-" ); // y = ( a + b ) - c = a added to b then subtracted by c CALC( y, a, b, c, "-+" ); // y = ( a - b ) + c = a subtracted by b then added to c CALC( y, a, b, c, "--" ); // y = ( a - b ) - c = a subtracted by b then subtracted by c CALC( y, a, b, c, "**" ); // y = ( a * b ) * c = a multiplied by b then multiplied by c CALC( y, a, b, c, "*/" ); // y = ( a * b ) / c = a multiplied by b then divided by c CALC( y, a, b, c, "/*" ); // y = ( a / b ) * c = a divided by b then multiplied by c CALC( y, a, b, c, "//" ); // y = ( a / b ) / c = a divided by b then divided by c
These commands return the numerical value y
as a function of the numerical values a
, b
, and c
.
Parameters
y
- Calculation result.
Parameter type: entity name of a numeric variable (egU8
,S32
,FLT3
etc). a
,b
andc
- Input value.
Parameter type: immediate number, or entity name of a numeric variable (egU8
,S32
,FLT3
etc). "..."
- CALC command operator.
Parameter type: immediate string.
Examples
Example 1
TBD