Math Functions
The functions listed in the table below are for SQL queries and should not be used with inline scripts.
The following table lists the math functions used in Logi Info:
Function | Description/Example |
---|---|
ABS(number) | Returns the absolute value of a number. e.g. ABS(-10) returns 10 |
EXP(number) | Returns e raised to the power of a given number. e.g. EXP(2) returns 7.38905609893065 |
INT(number) | Rounds the number down to the nearest integer. e.g. INT(3.995) return 3 |
LOG(number, base) | Returns the logarithm of a number to the base you specify. e.g. LOG(10,2.71828182845905) returns 2.30258509299405 |
MAX(number1, number2,...) | Returns the largest number in a set of values. Ignores logical values and text. e.g. MAX(10.01, 34, 22, 13.5, 21.563, -34) returns 34 |
MIN(number,...) | Returns the smallest number in a set of values. Ignores logical values and text. e.g. MIN(10.01, 34, 22, 13.5, 21.563, -31) returns -31 |
MOD(number, divisor) | Returns the remainder after a number is divided by a divisor. e.g. MOD(10, 4) returns 2 |
POWER(number, power) | Returns the result of a number raised to the power. e.g. POWER(2, 3) returns 8 |
RANDOM() | Returns a random float between 0 and 1. Does not accept arguments. e.g. RANDOM() returns 0.937688089853821 |
ROUND(number, decimals) | Rounds a number to a specified number of digits. e.g. ROUND(10.43432,2) returns 10.43 |
SIGN(number) | Returns the sign of a number. 1 if the number is positive, 0 if the number is zero, or -1 if the number is negative. e.g. SIGN(345.342) returns 1 |
SQRT(number) | Returns the square root of a number. e.g. SQRT(9) returns 3 |