Math Functions
Provides deterministic mathematical functions for use inside AiSQL logic, expressions, and semantic evaluations. All functions are side-effect free and safe for inference.
| Name | Parameters | Returns | Description |
| Math.Abs | (decimal value) | decimal | Returns the absolute value of a decimal number. |
| Math.Add | (decimal a, decimal b) | decimal | Adds two decimal values. |
| Math.Clamp | (decimal value, decimal min, decimal max) | decimal | Restricts a value to be within the specified minimum and maximum range. |
| Math.Divide | (decimal a, decimal b) | decimal | Divides the first decimal value by the second. |
| Math.Max | (decimal a, decimal b) | decimal | Returns the larger of two decimal values. |
| Math.Min | (decimal a, decimal b) | decimal | Returns the smaller of two decimal values. |
| Math.Multiply | (decimal a, decimal b) | decimal | Multiplies two decimal values. |
| Math.Subtract | (decimal a, decimal b) | decimal | Subtracts the second decimal value from the first. |
Examples
RULE PriceMomentum
IF
MATH.ABS(Price - VWAP) > 1.25
AND
LOG(Volume + 1) > 2.0
THEN
ACTION = 'IncreaseExposure'