This content describes Snap 11. For Snap 10, the equivalent page will be in Snap 10 help
A Numeric Operator is used to perform some calculation on either one or two numeric values. Those operators calculating with one value (or operand) are called unary operators, those working with two operands are called binary operators.
Numeric operations can be performed on numeric constants or quantity or single response variables. They will give an error if an attempt is made to operate on multiple, literal, time or date values. The result of a numeric operation is a numeric value.
Table of numeric binary operators for use with numeric expressions
Operator |
|
Description |
|---|---|---|
+ |
Plus |
The result is the sum of the first operand with the second. |
- |
Minus |
The result is the second operand subtracted from the first. |
* |
Multiply |
The result is the first operand multiplied by the second. |
/ |
Divide |
The result is the first operand divided by the second. If the second operand is zero the result will be an Error value. |
\ |
Integer Divide |
The result is the first operand divided by the second, and then rounded down to the nearest whole number. If the second operand is zero the result will be an Error value. |
@ |
Substring position |
The result is the position of the second operand within the first. If the second operand does not appear in the first, the result will be No Reply. For example |
Table of numeric unary operators for use with numeric expressions
Operator |
|
Description |
|---|---|---|
+ |
Absolute |
The result is the absolute value of the one operand. If the operand is a negative value then the result is a positive value of the same magnitude; if already positive the value is unchanged. |
- |
Negate |
The result is the value of the one operand negated. If the operand is a positive value then the result is a negative value of the same magnitude. If the operand is a negative value then the result is a positive value of the same magnitude. |
|
See Also |