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.

NameParametersReturnsDescription
Math.Abs(decimal value)decimalReturns the absolute value of a decimal number.
Math.Add(decimal a, decimal b)decimalAdds two decimal values.
Math.Clamp(decimal value, decimal min, decimal max)decimalRestricts a value to be within the specified minimum and maximum range.
Math.Divide(decimal a, decimal b)decimalDivides the first decimal value by the second.
Math.Max(decimal a, decimal b)decimalReturns the larger of two decimal values.
Math.Min(decimal a, decimal b)decimalReturns the smaller of two decimal values.
Math.Multiply(decimal a, decimal b)decimalMultiplies two decimal values.
Math.Subtract(decimal a, decimal b)decimalSubtracts 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'