Math functions in Jitterbit Design Studio
The math functions provide additional mathematical operators beyond the basic arithmetical operators of Jitterbit Script.
Ceiling
Declaration
int Ceiling(double d)
Syntax
Ceiling(<d>)
Required parameters
d
: A double value
Description
Returns the mathematical ceiling (rounded up to the nearest integer) of a given value as an integer. The argument should be a double and is first converted to a double if not.
Examples
Ceiling(52.154); // Returns a value of 53
Exp
Declaration
double Exp(double d)
Syntax
Exp(<d>)
Required parameters
d
: A double value
Description
Returns the mathematical result e^d, or e to the power of d. The argument should be a double and is first converted to a double if not.
Examples
Exp(4.60517); // Returns a value of 100 (99.9999814011926)
Floor
Declaration
int Floor(double d)
Syntax
Floor(<d>)
Required parameters
d
: A double value
Description
Returns the mathematical floor (rounded down to the nearest integer) of a given value as an integer. The argument should be a double and is first converted to a double if not.
Examples
Floor(52.654); // Returns a value of 52
Log
Declaration
double Log(double d)
Syntax
Log(<d>)
Required parameters
d
: A double value
Description
Returns the natural log (logarithm to the base e) of a given value. The argument should be a double and is first converted to a double if not.
Examples
Log(100); // Returns a value of 4.60517018598809
Log("5a"); // Returns 1.6094379124341
// Treated as if Log(5)
Log10
Declaration
double Log10(double d)
Syntax
Log10(<d>)
Required parameters
d
: A double value
Description
Returns the logarithm to the base 10 of a given value. The argument should be a double and is first converted to a double if not.
Examples
log10(100); // Returns a value of 2
log10("5a"); // Returns 0.698970004336019
// Treated as if Log10(5)
Mod
Declaration
long Mod(long numerator, long denominator)
Syntax
Mod(<numerator>, <denominator>)
Required parameters
numerator
: A long valuedenominator
: A long value
Description
Calculates the modulus (the remainder) of the division of the numerator by the denominator. The return value has the same sign as the numerator. If the denominator is 0, the numerator is returned.
Examples
Mod(3005, 1000); // Returns 5
Mod(204, 17); // Returns 0
Mod(-206, 17); // Returns -2
Pow
Declaration
double Pow(double base, double exponent)
Syntax
Pow(<base>, <exponent>)
Required parameters
- base: A double value,
- exponent: A double value
Description
Returns the mathematical result base^exponent, or base to the power of exponent. The arguments should be doubles and are first converted to doubles if not.
Examples
Pow(2,3); // Returns a value of 8
Round
Declaration
string Round(double d[, int numPlaces])
Syntax
Round(<d>[, <numPlaces>])
Required parameters
- d: A double value
Optional parameters
numPlaces
: An integer number of places of precision. If omitted, the default is 0.
Description
Returns the given value rounded to a specified precision and then converted to a string. The argument should be a double and is first converted to a double if not. This function is designed for displaying values (not computing) as the output is a string.
This function is similar to the String Format
function.
Examples
Round(9.53537465, 4); // Returns the string "9.5354"
RoundToInt
Declaration
int RoundToInt(double d)
Syntax
RoundToInt(<d>)
Required parameters
d
: A double value
Description
Returns the given value rounded to the nearest integer (no decimal places). The argument should be a double and is first converted to a double if not.
Examples
RoundToInt(9.5353); // Returns a value of 10
Sqrt
Declaration
double Sqrt(double d)
Syntax
Sqrt(<d>)
Required parameters
d
: A double value
Description
Returns the square root of a given value. The argument should be a double and is first converted to a double if not.
Examples
Sqrt(9); // Returns a value of 3