FLOAT
Performs floating point math operations.
- Valid characters for the values are digits 0-9, '-', and '.'
- Other characters cause an error in the interpretation of the value.
- ‘<‘ (less than) and ‘>’ (greater than) operations return ‘0’ for false and ‘1’ for true.
- For negative values, make sure the ‘-’ (minus sign) immediately precedes the value without any spaces.
Syntax
FLOAT(value1, operator, value2, digits)
Arguments
Argument | Description | Default |
---|---|---|
value1 | First value to be used | None |
operator | Mathematical operator to be applied to the two values. Valid characters include: + (add) - (subtract) * (multiply) / (divide) < (less than) > (greater than) |
None |
value2 | Second value to be used. | None |
digits | Number of digits beyond the decimal point to be returned. | 2 |
Results
Result | Description | |
---|---|---|
Return | The string representation of the result. If the value is ‘<‘ or ‘>’ the return value is '1' true, or '0' if false. '0' is returned when the argument is invalid, such as when dividing by ‘0’. |
|
%%RC | One of the following: | |
-2 | / was used and value2 was 0. | |
-1 | Invalid operator was used. | |
0 | No error. | |
%%RM | A null string (''). | |
%%RV | Always 0. |
Examples
Function Call | Return Value | %%RC |
---|---|---|
FLOAT('2.2', '+', '3.3') | 5.50 | 0 |
FLOAT('2.2', '-', '3.3', 4) | -1.1000 | 0 |
FLOAT('5', '/', '0') | 0 | -2 |
FLOAT('5.5', '>', '7') | 0 | 0 |
FLOAT('5.5', '<', '7') | 1 | 0 |