Numbers and Missing or Invalid Data
Arithmetic operators, such as +, -, *, and / are used to perform operations on values.
For example, the + operator is used to add together two values:
1.0 + 1.0 = 2.0
Other supported arithmetic operations include the following.
| Name | Operator | Description | Example |
|---|---|---|---|
| Addition | + | Adds two values together | x + y |
| Subtraction | - | Subtracts one value from another value | x - y |
| Multiplication | * | Multiplies two values | x * y |
| Division | / | Divides one value by another value | x / y |
There are cases when a null value or missing data is involved in arithmetic operations.
Missing data
By default, when one of the operands is missing from a binary operator (such as, add, sub, mul, or div), the operation provides another operand as a result. In the C3 Agentic AI Platform, missing data is represented as null.
5.0 + null = 5.0
5.0 * null = 5.0
null - 5.0 = 5.0
null / 5.0 = 5.0
5.0 % null = 5.0
When both operands are null, the result is null.
With comparison operations, if one of the operands is null, the result is false. However, when both operands are null they are equal.
5.0 > null = false
5.0 < null = false
5.0 == null = false
Invalid data
Invalid values are represented as NaN. Any arithmetic operations with invalid values as input result in an invalid result.
5.0 + NaN = NaN
5.0 * NaN = NaN
Any comparison operations result in false.
5.0 > NaN = false
5.0 < NaN = false