Skip to main content

Math Functions

Arithmetic Functions

Expressions support many standard arithmetic functions:

  • abs(x): Compute absolute value of a number
  • ceil(x): Round value up to next integer
  • floor(x): Round a value down to next integer
  • log(x, base): Calculate the logarithm of a value
  • round(x, n): Round to the nearest integer or n decimal places
  • sqrt(x): Calculate the square root of a value

Examples:

floor(AIN0)
round(abs(spindle-speed))

Statistics Functions

Expressions support several statistical functions. These functions can consume an arbitrary number of arguments, including variables, data sources, or constants.

  • max(a, b, ...): Compute the maximum value of the passed values
  • mean(a, b, ...): Compute the mean value of the passed values
  • median(a, b, ...): Compute the median value of the passed values
  • min(a, b, ...): Compute the minimum value of the passed values
  • mode(a, b, ...): Compute the mode of the passed values
  • prod(a, b, ...): Compute the product of the passed values
  • std(a, b, ...): Compute the standard deviation of the passed values
  • sum(a, b, ...): Compute the sum of the passed values
  • variance(a, b, ...): Compute the variance of the passed values

Examples:

max(spindle-1, spindle-2, spindle-3) > 6000

Trig Functions

Expressions support several trigonometry functions.

  • acos(x): Calculate the inverse cosine of a value
  • acot(x): Calculate the inverse cotangent of a value
  • acsc(x): Calculate the inverse cosecant of a value
  • asec(x): Calculate the inverse secant of a value
  • asin(x): Calculate the inverse sine of a value
  • atan(x): Calculate the inverse tangent of a value
  • cos(x): Calculate the cosine of a value
  • cot(x): Calculate the cotangent of a value
  • csc(x): Calculate the cosecant of a value
  • sec(x): Calculate the secant of a value
  • sin(x): Calculate the sine of a value
  • tan(x): Calculate the tangent of a value