Mathematical functions
The mathematical functions perform mathematical operations.
The mathematical functions are in the Mathematical category
of the expression editor. Square brackets indicate that an argument
is optional. The examples show the function as it appears in a Derivation field
in the Transformer stage.
- Abs
- Returns the absolute value of any numeric expression. The absolute
value of an expression is its unsigned magnitude.
- Input: numeric_expression (int32)
- Output: result (dfloat)
- Examples. If mylink.number1 contains the number 12 and
mylink.number2 contains the number 34, then the following two functions
are equivalent, and return the number 22:
If mylink.number1 contains the number 34 and mylink.number2 contains the number 12, then the following two functions are equivalent, and return the number 22:Abs(12-34) Abs(mylink.mynumber1-mylink.mynumber2)
Abs(34-12) Abs(mylink.mynumber1-mylink.mynumber2)
- Acos
- Calculates the trigonometric arc-cosine of an expression. The
expression must be a numeric value. The result is expressed in radians.
- Input: numeric_expression (dfloat)
- Output: result (dfloat)
- Examples. If mylink.number contains the number 0.707106781,
then the following two functions are equivalent, and return the value
0.785398:
Acos(0.707106781) Acos(mylink.mynumber)
- Asin
- Calculates the trigonometric arc-sine of an expression. The expression
must be a numeric value. The result is expressed in radians.
- Input: numeric_expression (dfloat)
- Output: result (dfloat)
- Examples. If mylink.number contains the number 0.707106781,
then the following two functions are equivalent, and return the value
0.785398:
Asin(0.707106781) Asin(mylink.mynumber)
- Atan
- Calculates the trigonometric arc-tangent of an expression. The
expression must be a numeric value. The result is expressed in radians.
- Input: numeric_expression (dfloat)
- Output: result (dfloat)
- Examples. If mylink.number contains the number 135, then
the following two functions are equivalent, and return the value 1.56339,
which is the angle that has an arc tangent of 135:
Atan(135) Atan(mylink.mynumber)
- Atan2
- Calculates the trigonometric arc-tangent of the two inputs by
using the signs of the two inputs to determine the quadrant of the
result. The inputs must be numeric values. The result is expressed
in radians.
- Input: numeric_expression (dfloat, dfloat)
- Output: result (dfloat)
- Examples. If mylink.number1 contains the number 10.0 and
mylink.number2 contains the number -10.0, then the following two functions
are equivalent, and return the value 2.35619:
Atan2(10.0. -10.0) Atan2(mylink.mynumber1, mylink.mynumber2)
- Ceil
- Calculates the smallest integer value greater than or equal to
the given decimal value.
- Input: number (dfloat)
- Output: result (int32)
- Examples. If mylink.number contains the number 2355.66,
then the following two functions are equivalent, and return the value
2356:
Ceil(2355.66) Ceil(mylink.mynumber)
- Cos
- Calculates the trigonometric cosine of an expression. The expression
must be a numeric value. The expression must produce a numeric value
that is the angle in radians.
- Input: radians (dfloat)
- Output: result (dfloat)
- Examples. If mylink.number contains the number 0.785398,
then the following two functions are equivalent, and return the value
0.7071:
Cos(0.785398) Cos(mylink.mynumber)
- Cosh
- Calculates the hyperbolic cosine of an expression. The expression
must be a numeric value.
- Input: number (dfloat)
- Output: result (dfloat)
- Examples. If mylink.number contains the number 2, then
the following two functions are equivalent, and return the value 3.7622:
Cosh(2) Cosh(mylink.mynumber)
- Div
- Outputs the whole part of the real division of two real numbers
(dividend, divisor).
- Input: dividend (dfloat), divisor (dfloat)
- Output: result (dfloat)
- Examples. If mylink.dividend contains the number 100, and
mylink.divisor contains the number 25, then the following two functions
are equivalent, and return the value 4:
Div(100,25) Div(mylink.dividend,mylink.divisor)
- Exp
- Calculates the result of base e raised to the
power designated by the value of the expression. The value of e is
approximately 2.71828. The expression must evaluate to a numeric value.
- Input: number (dfloat)
- Output: result (dfloat)
- Examples. If mylink.number contains the number 5, then
the following two functions are equivalent, and return the value 54.5982:
Exp(5-1) Exp(mylink.number-1)
- Fabs
- Calculates the absolute value of the given float value.
- Input: number (dfloat)
- Output: result (dfloat)
- Examples. If mylink.number contains the number -26.53,
then the following two functions are equivalent, and return the value
26.53:
Fabs(-26.53) Fabs(mylink.number)
- Floor
- Calculates the largest integer value less than or equal to the
given decimal value.
- Input: number (dfloat)
- Output: result (int32)
- Examples. If mylink.number contains the number 203.25,
then the following two functions are equivalent, and return the value
203:
Floor(203.25) Floor(mylink.number)
- Ldexp
- Returns a dfloat value from multiplying the mantissa by 2 raised
to the power of the exponent.
- Input: mantissa (dfloat), exponent (int32)
- Output: result (dfloat)
- Examples. If mylink.mantissa contains the number 2, and
mylink.exponent contains the number 3, then the following two functions
are equivalent, and return the value 16:
Floor(2,3) Floor(mylink.mantissa,mylink.exponent)
- Llabs
- Calculates the absolute value of the given integer value.
- Input: number (integer)
- Output: result (unsigned integer)
- Examples. If mylink.number contains the number -26, then
the following two functions are equivalent, and return the value 26:
Llabs(-26) Llabs(mylink.number)
- Ln
- Calculates the natural logarithm of an expression in base e.
The value of e is approximately 2.71828. The expression
must evaluate to a numeric value greater than 0.
- Input: number (dfloat)
- Output: result (dfloat)
- Examples. If mylink.number contains the number 6, then
the following two functions are equivalent, and return the value 1.79176:
Ln(6) Ln(mylink.number)
- Log10
- Returns the logarithm in base 10 of the given value.
- Input: number (dfloat)
- Output: result (dfloat)
- Examples. If mylink.number contains the number 6, then
the following two functions are equivalent, and return the value 0.778151:
Log10(6) Log10(mylink.number)
- Max
- Returns the greater of the two argument values.
- Input: number1 (int32),number2(int32)
- Output: result (int32)
- Examples. If mylink.number1 contains the number 6, and
mylink.number1 contains the number 101, then the following two functions
are equivalent, and return the value 101:
Max(6,101) Max(mylink.number1,mylink.number2)
- Min
- Returns the lower of the two argument values.
- Input: number1 (int32),number2(int32)
- Output: result (int32)
- Examples. If mylink.number1 contains the number 6, and
mylink.number1 contains the number 101, then the following two functions
are equivalent, and return the value 6:
Min(6,101) Min(mylink.number1,mylink.number2)
- Mod
- Calculates the modulo (the remainder) of two expressions (dividend,
divisor).
- Input: dividend (int32),divisor (int32)
- Output: result (int32)
- Examples. If mylink.dividend contains the number 115, and
mylink.divisor contains the number 25, then the following two functions
are equivalent, and return the value 15:
Mod(115,25) Mod(mylink.dividend,mylink.divisor)
- Neg
- Negates a number.
- Input: number (dfloat)
- Output: result (dfloat)
- Examples. If mylink.number contains the number 123, then
the following two functions are equivalent, and return the value -123:
Neg(123) Neg(mylink.number)
- Pwr
- Calculates the value of an expression when raised to a specified
power (expression, power).
- Input: expression (dfloat),power (dfloat)
- Output: result (dfloat)
- Examples. If mylink.expression contains the number 2, and
mylink.power contains the number 3, then the following two functions
are equivalent, and return the value 8:
Pwr(2,3) Pwr(mylink.expression,mylink.power)
- Rand
- Returns a pseudorandom integer between 0 and 232-1.
- Input: Not applicable
- Output: result (uint32)
- Examples. Use this function to add a column to your output
that contains a pseudorandom number:
Rand()
- Random
- Returns a random number between 0 and 232-1.
- Input: Not applicable
- Output: result (uint32)
- Examples. Use this function to add a column to your output
that contains a random number:
Random()
- Sin
- Calculates the trigonometric sine of an expression. The expression
must be a numeric value. The expression must produce a numeric value
that is the angle in radians.
- Input: radians (dfloat)
- Output: result (dfloat)
- Examples. If mylink.number contains the number 0.785398,
then the following two functions are equivalent, and return the value
0.7071:
Sin(0.785398) Sin(mylink.mynumber)
- Sinh
- Calculates the hyperbolic sine of an expression. The expression
must be a numeric value.
- Input: number (dfloat)
- Output: result (dfloat)
- Examples: If mylink.number contains the number 2, then
the following two functions are equivalent, and return the value 3.62686:
Sinh(2) Sinh(mylink.mynumber)
- Sqrt
- Calculates the square root of a number.
- Input: number (dfloat)
- Output: result (dfloat)
- Examples: If mylink.number contains the number 450, then
the following two functions are equivalent, and return the value 21.2132:
Sqrt(450) Sqrt(mylink.mynumber)
- Tan
- Calculates the trigonometric tangent of an expression. The expression
must produce a numeric value that is the angle in radians.
- Input: radians (dfloat)
- Output: result (dfloat)
- Examples. If mylink.number contains the number 0.7853981,
then the following two functions are equivalent, and return the value
0.7071:
Tan(0.7853981) Tan(mylink.mynumber)
- Tanh
- Calculates the hyperbolic tangent of an expression. The expression
must be a numeric value.
- Input: number (dfloat)
- Output: result (dfloat)
- Examples: If mylink.number contains the number 2, then
the following two functions are equivalent, and return the value 0.964028:
Tanh(2) Tanh(mylink.mynumber)