Math functions

Math functions perform mathematical operations on your data.

This table describes the math functions that Transform supports.

User Function Return Data Type Description

abs(double d)

abs(float f)

abs(int i)

abs(long l)

double

float

int

long

Calculates the argument's absolute value.
acos(double d) double Calculates the arccosine of a double. The returned angle is between 0.0 and pi.
asin(double d) double Calculates the arcsine of a double. The returned angle is between -pi/2 and pi/2.
atan(double d) double Calculates the arctangent of a double. The returned angle between -pi/2 and pi/2.
atan2(double y, double x) double Calculates the angle theta from the conversion of rectangular coordinates (x,y) to polar coordinates (r,theta).
cbrt(double d) double Calculates the cube root of a double.
ceil(double d) double Returns the smallest (i.e., closest to negative infinity) double value that is greater than or equal to the argument, and is equal to a mathematical integer.

copySign(double a, double b)

copySign(float a, float b)

double

float

Returns the first floating-point argument with the sign of the second floating-point argument.
cos(double a) double Calculates the trigonometric cosine of an angle.
cosh(double d) double Calculates the hyperbolic cosine of a double.
exp(double d) double Returns Euler's number e raised to the power of a double value.
expm1(double x) double Returns ex-1.
floor(double d) double Returns the largest (i.e., closest to positive infinity) double value that is less than or equal to the argument, and is equal to a mathematical integer.
getExponent(double d) int Returns the unbiased exponent used in the representation of a double.
hypot(double x, double y) double Returns sqrt(x2 + y2) without intermediate overflow or underflow.
log(double d) double Returns the natural logarithm (base e) of a double.
log10(double d) double Returns the base 10 logarithm of a double.
log1p(double d) double Returns the natural logarithm of the sum of a double and 1.

max(double a, double b)

max(float a, float b)

max(int a, int b)

max(long a, long b)

double

float

int

long

Returns the greater of the two arguments.

min(double a, double b)

min(float a, float b)

min(int a, int b)

min(long a, long b)

double

float

int

long

Returns the lesser of the two arguments.

nextAfter(double a, double b)

nextAfter(float a, double b)

double

float

Returns the floating-point number adjacent to the first argument in the direction of the second.

nextUp(double a)

nextUp(float a)

double

float

Returns the floating-point value adjacent to the argument in the direction of positive infinity.
pow(double a, double b) double Returns the value of the first argument raised to the power of the second.
rint(double a) double Returns the double value that is closest in value to the argument and is equal to a mathematical integer.
random() double Returns a positive double value that is greater than or equal to 0.0 and is less than 1.0.

round(double a)

round(float a)

long

int

Returns the closest value to the argument, with ties rounding up.
roundWithPrecision(double a, int b) double Rounds a with the precision defined by b.

scalb(double a, int b)

scalb(float a, int b)

double

float

Returns a × 2b rounded as if performed by a single, correctly-rounded floating-point multiply to a member of the float value set.

signum(double a)

signum(float a)

double

float

Returns the signum of the argument: 0 if the argument is 0, 1.0 if the argument is greater than 0, -1.0 if the argument is less than 0.
sin(double a) double Calculates the trigonometric sine of an angle.
sinh(double a) double Calculates the hyperbolic sine of the argument.
sqrt(double a) double Calculates the correctly-rounded positive square root of the argument.
tan(double a) double Calculates the trigonometric tangent of an angle.
tanh(double a) double Calculates the hyperbolic tangent of a.
toRadians(double angle) double Converts an angle measured in degrees to an approximately equivalent angle measured in radians.
truncateNumber(double number, int precision) double Truncates a number using the specified precision.

ulp(double a)

ulp(float a)

double

float

Returns the size of a ULP of the argument.