This topic describes the syntax of arithmetic functions and provides parameter description and function examples.

Functions

Type Function Description
Sum calculation op_sum Returns the sum of passed values.
Basic calculation op_abs Returns the absolute value of a passed value.
op_div_floor Returns the integer part of the quotient after a division of two passed values.
op_pow Returns a value raised to a specified power.
op_mul Returns the product of two passed values.
op_neg Returns the opposite number of a passed value.
op_mod Returns the remainder after a division of two passed values.
op_sub Returns the differences of two passed values.
op_round Returns the result of rounding a passed value to a specified number of decimal places.
Mathematical calculation mat_ceil Returns the smallest integer not less than a passed value.
mat_exp Returns the result of raising e to the power of a passed value.
mat_fabs Returns the absolute value of a passed value.
mat_floor Returns the largest integer not greater than a passed value.
mat_log Returns the logarithm of a passed value.
mat_log10 Returns the base-10 logarithm of a passed value.
mat_sqrt Returns the square root of a passed value.
mat_degrees Converts radians to degrees.
mat_radians Converts degrees to radians.
mat_sin Returns the sine of a passed value (in radians).
mat_cos Returns the cosine of a passed value (in radians).
mat_tan Returns the tangent of a passed value (in radians).
mat_acos Returns the arc cosine (in radians) of a passed value.
mat_asin Returns the arc sine (in radians) of a passed value.
mat_atan Returns the arc tangent (in radians) of a passed value.
mat_atan2 Returns the arc tangent of X- and Y-coordinates.
mat_atanh Returns the inverse hyperbolic tangent of a passed value.
mat_hypot Returns the Euclidean norm of passed values.
MATH_PI The constant pi.
MATCH_E The constant e.

op_sum

  • Syntax
    op_sum(Value 1, Value 2, ...)
  • Parameters
    Parameter Type Required? Description
    Value 1 Number or numeric string Yes The value used for the calculation.
    Value 2 Number or numeric string Yes The value used for the calculation.
  • Response

    The sum of all passed values is returned.

  • Example: Calculate the sum of the values of the course_price and goods_price fields.
    Raw log:
    course_price: 12
    goods_price: 2
    Processing rule:
    e_set("account", op_sum(v("course_price"),v("goods_price")))
    Processing result:
    course_price: 12
    goods_price: 2
    account: 14

op_abs

  • Syntax
    op_abs(Value)
  • Parameters
    Parameter Type Required? Description
    Value Number or numeric string Yes The value used for the calculation.
  • Response

    The absolute value of the passed value is returned.

  • Example: Calculate the absolute value of the value of the course_price field.
    Raw log:
    course_price: -4
    Processing rule:
    e_set("op_abs", op_abs(v("course_price")))
    Processing result:
    course_price: -4
    op_abs: 4

op_div_floor

  • Syntax
    op_div_floor(Value 1, Value 2)
  • Parameters
    Parameter Type Required? Description
    Value 1 Number or numeric string Yes The value used for the calculation.
    Value 2 Number or numeric string Yes The value used for the calculation.
  • Response

    The integer part of the quotient after Value 1 is divided by Value 2 is returned.

  • Example: Calculate the price of a course.
    Raw log:
    course_price: 4
    count: 2
    Processing rule:
    e_set("op_div_floor", op_div_floor(v("course_price"),v("count")))
    Processing result:
    course_price: 4
    count: 2
    op_div_floor: 2

op_pow

  • Syntax
    op_pow(Value 1,Value 2)
  • Parameters
    Parameter Type Required? Description
    Value 1 Number or numeric string Yes The value used for the calculation.
    Value 2 Number or numeric string Yes The value used for the calculation.
  • Response

    Value 1 raised to the power of Value 2 is returned.

  • Example: Calculate the value of the course field raised to the power of the pow field.
    Raw log:
    course: 100
    pow: 2
    Processing rule:
    e_set("pow_course", op_pow(v("course"),v("pow")))
    Processing result:
    course: 100
    pow: 2
    pow_course: 10000

op_mul

  • Syntax
    op_mul(Value 1,Value 2)
  • Parameters
    Parameter Type Required? Description
    Value 1 Number, string, tuple, list, and so on Yes The value used for the calculation.
    Value 2 Number Yes The value used for the calculation.
  • Response
    The result of multiplying Value 1 by Value 2 is returned.
    • If Value 1 is a number, the product of multiplying Value 1 by Value 2 is returned.
    • If Value 1 is not a number, for example, it is a string, tuple, or list, the result is the original value repeated for the specified times.
  • Examples
    • Example 1:
      Raw log:
      course: 10
      price: 23
      Processing rule:
      e_set("account", op_mul(ct_int(v("course")),ct_int(v("price"))))
      Processing result:
      course: 10
      price: 23
      account: 230
    • Example 2:
      Raw log:
      course: "abc"
      Processing rule:
      e_set("course", op_mul(v("course"), 3))
      Processing result:
      course: "abcabcabc"

op_neg

  • Syntax
    op_neg(Value)
  • Parameters
    Parameter Type Required? Description
    Value Number or numeric string Yes The value used for the calculation.
  • Response

    The opposite number of the passed value is returned.

  • Examples
    Raw log:
    course: -100
    Processing rule:
    e_set("account", op_neg(v("course_price")))
    Processing result:
    course: -100
    account: 100

op_mod

  • Syntax
    op_mod(Value 1,Value 2)
  • Parameters
    Parameter Type Required? Description
    Value 1 Number or numeric string Yes The value used for the calculation.
    Value 2 Number or numeric string Yes The value used for the calculation.
  • Response

    The remainder after Value 1 is divided by Value 2 is returned.

  • Examples
    Raw log:
    course: 4
    count: 3
    Processing rule:
    e_set("op_mod", op_mod(v("course"),v("count")))
    Processing result:
    course: 4
    count: 3
    op_mod: 1

op_sub

  • Syntax
    op_sub(Value 1,Value 2)
  • Parameters
    Parameter Type Required? Description
    Value 1 Number or numeric string Yes The value used for the calculation.
    Value 2 Number or numeric string Yes The value used for the calculation.
  • Response

    The result of subtracting Value 2 from Value 1 is returned.

  • Example: Calculate the result of subtracting the value of the count_apple field from the value of the count field.
    Raw log:
    count: 6
    count_apple: 3
    Processing rule:
    e_set("sub_number", op_sub(v("count"),v("count_apple")))
    Processing result:
    count: 6
    count_apple: 3
    sub_number:  3

op_round

  • Syntax
    op_round(Value, Decimal place)
  • Parameters
    Parameter Type Required? Description
    Value Number or numeric string Yes The value used for the calculation.
    Decimal place Number Yes The number of decimal places to keep. Default value: 0.
  • Response

    The result of rounding the passed value is returned.

  • Example: Round the value of the price field to one decimal place.
    Raw log:
    price: 4.56
    Processing rule:
    e_set("round_price", op_round(v("price"),1))
    Processing result:
    price: 4.56
    round_price: 4.6

mat_ceil

  • Syntax
    mat_ceil(Value)
  • Parameters
    Parameter Type Required? Description
    Value Number or numeric string Yes The value used for the calculation.
  • Response

    The smallest integer not less than the passed value is returned.

  • Examples
    Raw log:
    price: 4.1
    Processing rule:
    e_set("mat_ceil", mat_ceil(v("price")))
    Processing result:
    price: 4.1
    mat_ceil: 5

mat_exp

  • Description

    You can call this function to calculate the result of raising e to the power of a passed value.

  • Syntax
    mat_exp(Value)
  • Parameters
    Parameter Type Required? Description
    Value Number or numeric string Yes The value used for the calculation.
  • Response

    The result of raising e to the power of the passed value is returned.

  • Examples
    Raw log:
    e: 1
    Processing rule:
    e_set("e_x", mat_exp(v("e")))
    Processing result:
    e: 1
    e_x: 2.718281828459045

mat_fabs

  • Description

    You can call this function to calculate the absolute value of a passed value.

  • Syntax
    mat_fabs(Value)
  • Parameters
    Parameter Type Required? Description
    Value Number or numeric string Yes The value used for the calculation.
  • Response

    The absolute value of the passed value is returned.

  • Examples
    Raw log:
    course_price: -10
    Processing rule:
    e_set("mat_fabs", mat_fabs(v("course_price")))
    Processing result:
    course_price: -10
    mat_fabs: 10.0

mat_floor

  • Description

    You can call this function to obtain the largest integer not greater than a passed value.

  • Syntax
    mat_floor(Value)
  • Parameters
    Parameter Type Required? Description
    Value Number or numeric string Yes The value used for the calculation.
  • Response

    The largest integer not greater than the passed value is returned.

  • Examples
    Raw log:
    course_price: 4.9
    Processing rule:
    e_set("mat_floor", mat_floor(v("course_price")))
    Processing result:
    course_price: 4.9
    mat_floor: 4

mat_log

  • Description

    You can call this function to calculate the logarithm of a passed value.

  • Syntax
    mat_log(Value 1,Value 2)
  • Parameters
    Parameter Type Required? Description
    Value 1 Number or numeric string Yes The value used for the calculation.
    Value 2 Number or numeric string Yes The value used for the calculation.
  • Response

    The logarithm of the passed value is returned.

  • Examples
    Raw log:
    number1: 100
    number2: 10
    Processing rule:
    e_set("mat_log", mat_log(v("number1"),v("number2")))
    Processing result:
    number1: 100
    number2: 10
    mat_log: 2.0

mat_log10

  • Description

    You can call this function to calculate the base-10 logarithm of a passed value.

  • Syntax
    mat_log10(Value)
  • Parameters
    Parameter Type Required? Description
    Value Number or numeric string Yes The value used for the calculation.
  • Response

    The base-10 logarithm of the passed value is returned.

  • Examples
    Raw log:
    number: 100
    Processing rule:
    e_set("number2", mat_log10(v("number")))
    Processing result:
    number: 100
    numbe2: 2.0

mat_sqrt

  • Description

    You can call this function to calculate the square root of a passed value.

  • Syntax
    mat_sqrt(Value)
  • Parameters
    Parameter Type Required? Description
    Value Number or numeric string Yes The value used for the calculation.
  • Response

    The square root of the passed value is returned.

  • Examples
    Raw log:
    number1: 100
    Processing rule:
    e_set("sqrt_account", mat_sqrt(v("number1")))
    Processing result:
    number1: 100
    sqrt_account: 10.0

mat_degrees

  • Description

    You can call this function to convert radians to degrees.

  • Syntax
    mat_degrees(Value)
  • Parameters
    Parameter Type Required? Description
    Value Number or numeric string Yes The value used for the calculation.
  • Response

    The degrees are returned.

  • Examples
    Raw log:
    num: 1
    Processing rule:
    e_set("mat_degrees", mat_degrees(v("num")))
    Processing result:
    num: 1
    mat_degrees: 57.29577951308232

mat_radians

  • Description

    You can call this function to convert degrees to radians.

  • Syntax
    mat_radians(Value)
  • Parameters
    Parameter Type Required? Description
    Value Number or numeric string Yes The value used for the calculation.
  • Response

    The radians are returned.

  • Examples
    Raw log:
    rad: 30
    Processing rule:
    e_set("mat_radians", mat_radians(v("rad")))
    Processing result:
    rad: 30
    mat_radians: 0.5235987755982988

mat_sin

  • Description

    You can call this function to calculate the sine of a passed value (in radians).

  • Syntax
    mat_sin(Value)
  • Parameters
    Parameter Type Required? Description
    Value Number or numeric string Yes The value used for the calculation.
  • Response

    The sine of the passed value (in radians) is returned.

  • Examples
    Raw log:
    sin: 90
    Processing rule:
    e_set("mat_sin", mat_sin(v("sin")))
    Processing result:
    sin: 90
    mat_sin: 0.8939966636005579

mat_cos

  • Description

    You can call this function to calculate the cosine of a passed value (in radians).

  • Syntax
    mat_cos(Value)
  • Parameters
    Parameter Type Required? Description
    Value Number or numeric string Yes The value used for the calculation.
  • Response

    The cosine of the passed value (in radians) is returned.

  • Examples
    Raw log:
    cos: 30
    Processing rule:
    e_set("mat_cos", mat_cos(v("cos")))
    Processing result:
    cos: 30
    mat_cos: 0.15425144988758405

mat_tan

  • Description

    You can call this function to calculate the tangent of a passed value (in radians).

  • Syntax
    mat_tan(Value)
  • Parameters
    Parameter Type Required? Description
    Value Number or numeric string Yes The value used for the calculation.
  • Response

    The tangent of the passed value (in radians) is returned.

  • Examples
    Raw log:
    tan: 30
    Processing rule:
    e_set("mat_tan", mat_tan(v("tan")))
    Processing result:
    tan: 30
    mat_tan: 1.6197751905438615

mat_acos

  • Description

    You can call this function to calculate the arc cosine (in radians) of a passed value.

  • Syntax
    mat_acos(Value)
  • Parameters
    Parameter Type Required? Description
    Value Number or numeric string Yes The value used for the calculation.
  • Response

    The arc cosine (in radians) of the passed value is returned.

  • Examples
    Raw log:
    acos: 1
    Processing rule:
    e_set("mat_acos", mat_acos(v("acos")))
    Processing result:
    acos: 1
    mat_acos: 0.0

mat_asin

  • Description

    You can call this function to calculate the arc sine (in radians) of a passed value.

  • Syntax
    mat_asin(Value)
  • Parameters
    Parameter Type Required? Description
    Value Number or numeric string Yes The value used for the calculation.
  • Response

    The arc sine (in radians) of the passed value is returned.

  • Examples
    Raw log:
    asin: 1
    Processing rule:
    e_set("mat_asin", mat_asin(v("asin")))
    Processing result:
    asin: 1
    mat_asin: 1.5707963267948966

mat_atan

  • Description

    You can call this function to calculate the arc tangent (in radians) of a passed value.

  • Syntax
    mat_atan(Value)
  • Parameters
    Parameter Type Required? Description
    Value Number or numeric string Yes The value used for the calculation.
  • Response

    The arc tangent (in radians) of the passed value is returned.

  • Examples
    Raw log:
    atan: 1
    Processing rule:
    e_set("mat_atan", mat_atan(v("atan")))
    Processing result:
    atan: 1
    mat_atan: 0.7853981633974483

mat_atan2

  • Description

    You can call this function to calculate the arc tangent of X- and Y-coordinates.

  • Syntax
    mat_atan2(x,y)
  • Parameters
    Parameter Type Required? Description
    x Number or numeric string Yes The X-coordinate.
    y Number or numeric string Yes The Y-coordinate.
  • Response

    The arc tangent of X- and Y-coordinates is returned.

  • Examples
    Raw log:
    atan1: 1
    atan2: 2
    Processing rule:
    e_set("mat_atan2", mat_atan2(v("atan1"),v("atan2")))
    Processing result:
    atan1: 1
    atan2: 2
    mat_atan2: 0.4636476090008061

mat_atanh

  • Description

    You can call this function to calculate the inverse hyperbolic tangent of a passed value.

  • Syntax
    mat_atanh(Value)
  • Parameters
    Parameter Type Required? Description
    Value Number or numeric string Yes The X-coordinate.
  • Response

    The inverse hyperbolic tangent of the passed value is returned.

  • Examples
    Raw log:
    atanh: 1
    Processing rule:
    e_set("mat_atanh", mat_atanh(v("atanh")))
    Processing result:
    atanh: 1
    mat_atanh: 0.7615941559557649

mat_hypot

  • Description

    You can call this function to calculate the Euclidean norm of passed values.

  • Syntax
    mat_hypot(Value 1,Value 2)
  • Parameters
    Parameter Type Required? Description
    Value 1 Number or numeric string Yes The X-coordinate.
    Value 2 Number or numeric string Yes The Y-coordinate.
  • Response

    The Euclidean norm of the passed values is returned.

  • Examples
    Raw log:
    hypot1: 1
    hypot2: 2
    Processing rule:
    e_set("mat_hypot", mat_hypot(v("hypot1"),v("hypot2")))
    Processing result:
    hypot1: 1
    hypot2: 2
    mat_hypot: 3.605551275463989