Math Methods

Use Primavera Cloud supported math methods to evaluate common mathematical functions, such as sine and cosine.

Refer to the official Java documentation for more information on each method.

Notes:

Math Methods

Method Signature

Description

Parameters

Example

Math.abs(Double value)

Returns a value representing the absolute value of the Double passed as an argument.

Double value - Value against which the absolute value will be computed.

Math.abs(-34.5); //returns 34.5

Math.abs(34.5); //returns 34.5

Math.acos(Double value)

Returns a value representing the result of computing the arc cosine of the Double passed as an argument.

Double value - Value against which arc cosine will be computed.

Math.acos(35.4); //returns NaN

Math.acos(.005); //returns 1.565796305961329

Math.asin(Double value)

Returns a value representing the result of computing the arc sine of the Double passed as an argument.

Double value - Value against which arc sine will be computed.

Math.asin(34.5); //returns NaN

Math.asin(.005); //returns 0.005000020833567712

Math.atan(Double value)

Returns a value representing the result of computing the arc tangent of the Double passed as an argument.

Double value - Value against which the arc tangent will be computed.

Math.atan(34.5); //returns 1.5418189329433354

Math.atan(.005); //returns 0.0049999583339583225

Math.ceil(Double value)

Returns a value representing the smallest mathematical integer that is greater than or equal to the Double passed as an argument.

Double value - Value against which the mathematical ceiling will be computed.

Math.ceil(35.4); //returns 36.0

Math.ceil(-35.4); //returns -35.0

Math.cos(Double value)

Returns a value representing the result of computing the cosine of the Double passed as an argument.

Double value - Value against which cosine will be computed.

Math.cos(35.4); //returns -0.6656134553337595

Math.cos(.005); //returns 0.9999875000260416

Math.cosh(Double value)

Returns a value representing the result of computing the hyperbolic cosine of the Double passed as an argument.

Double value - Value against which the hyperbolic cosine will be computed.

Math.cosh(35.4); //returns 1.1830270194762338E15

Math.cosh(.005); //returns 1.0000125000260416

Math.exp(Double value)

Returns a value representing the result of raising Euler's number to the power of the value of the Double passed as an argument.

Double value - Value representing the power to which Euler's number will be raised.

Math.exp(2); //returns 7.38905609893065

Math.floor(Double value)

Returns a value representing the largest mathematical integer that is less than or equal to the Double passed as an argument.

Double value - Value against which the mathematical floor will be computed.

Math.floor(35.4); //returns 35.0

Math.floor(-35.4); //returns -36.0

Math.log(Double value)

Returns a value representing the result of computing the natural logarithm of the Double passed as an argument.

Double value - Value against which logarithm will be computed.

Math.log(35.4); //returns 3.5409593240373143

Math.log10(Double value)

Returns a value representing the result of computing the base 10 logarithm of the Double passed as an argument.

Double value - Value against which base 10 logarithm will be computed.

Math.log10(35.4); //returns 1.5490032620257879

Math.max(Double valueOne, Double valueTwo)

Returns the greater of the two Doubles passed as arguments.

Double valueOne - First value to compare.

Double valueTwo - Second value to compare.

Math.max(35.4, 22.1); //returns 35.4

Math.min(Double valueOne, Double valueTwo)

Returns the lesser of the two Doubles passed as arguments.

Double valueOne - First value to compare.

Double valueTwo - Second value to compare.

Math.min(35.4, 22.1); //returns 22.1

Math.pow(Double valueOne, Double valueTwo)

Returns a value representing the result of raising the first Double passed as an argument to the power of the second argument.

Double valueOne - Value to raise to the power specified by the second argument.

Double valueTwo - Value specifying the power to which the first argument will be raised.

Math.pow(5.0, 2.0); //returns 25.0

Math.random()

Returns a random positive Double value greater than 0.0 and less than 1.0.

No method parameters.

Math.random(); //returns, for example, 0.9086713591277327

Math.round(Double value)

Returns an Integer representing the result of rounding the Double passed as an argument to the nearest mathematical integer.

Double value - Value to round to the nearest integer.

Math.round(35.4); //returns 35

Math.signum(Double value)

Returns an Integer value representing the signum function of the Double passed as an argument. Returns 0 if the argument is zero, returns -1 if the argument is negative, and returns 1 if the argument is positive.

Double value - Value against which signum will be computed.

Math.signum(35.4); //returns 1.0

Math.signum(0); //returns 0.0

Math.signum(-35.4); //returns -1.0

Math.sin(Double value)

Returns a value representing the result of computing the sine of the Double passed as an argument.

Double value - Value against which sine will be computed.

Math.sin(35.4); //returns -0.7462966756449163

Math.sin(.005); //returns 0.004999979166692708

Math.sqrt(Double value)

Returns a value representing the result of computing the square root of the Double passed as an argument.

Double value - Value against which square root will be computed.

Math.sqrt(25.0); //returns 5.0

Math.tan(Double value)

Returns a value representing the result of computing the tangent of the first Double passed as an argument.

Double value - Value against which tangent will be computed.

Math.tan(35.4); //returns 1.1212163300856046

Math.tan(.005); //returns 0.0050000416670833376

Math.toDegrees(Double value)

Returns the result of converting the Double passed as an argument measured in radians to a value measured in degrees.

Double value - Value to convert to degrees.

Math.toDegrees(35.4); //returns 2028.2705947631143

Math.toRadians(Double value)

Returns the result of converting the Double passed as an argument measured in degrees to a value measured in radians.

Double value - Value to convert to radians.

Math.toRadians(35.4); //returns 0.6178465552059926

Additional Math Methods

Method Signature

Description

Parameters

Example

Math.cbrt(Double value)

Returns the cube root of the Double passed as an argument.

Double value - Value against which the cube root will be calculated.

Math.cbrt(8.0); //returns 2.0

Math.IEEEremainder(Double dividend Double divisor)

Computes the remainder, as prescribed by the IEEE 754 standard, of the Doubles passed as arguments. The first argument represents the dividend, and the second argument represents the divisor.

Double dividend - A double value that represents the dividend of a division operation.

Double divisor - A double that represents the divisor of a division operation.

Math.IEEEremainder(10.0, 1.4) //returns 0.20000000000000062

Math.rint(Double value)

Returns a Double that is closest to the Double value passed as an argument and is also an Integer.

Double value - Value against which rint will be computed.

Math.rint(34.78); //returns 35.0

Math.ulp(Double value)

Returns the positive distance between the floating-point value of the Double passed as an argument and the Double value that is next largest in magnitude.

Double value -Value against which positive distance to a value of the next magnitude will be computed.

Math.ulp(12.2) //returns 1.7763568394002505E-15



Last Published Tuesday, May 21, 2024