Math functions perform mathematical operations on your data.
This table describes the math functions that Transform supports.
User Function | Return Data Type | Description |
---|---|---|
|
|
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 . |
|
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. |
|
Double |
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) |
Integer |
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. |
|
|
Returns the greater of the two arguments. |
|
|
Returns the lesser of the two arguments. |
nextAfter(Double a, Double b) |
Double |
Returns the floating-point number adjacent to the first argument in the direction of the second. |
nextUp(Double a) |
Double |
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, Integer precision) |
Double |
Returns the closest value to the argument, with ties rounding up.
The |
scalb(Double a, Integer b) |
Double |
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) |
Double |
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 . |
toDegrees(Double angle) |
Double |
Converts an angle measured in radians to an approximately equivalent angle measured in degrees. |
toRadians(Double angle) |
Double |
Converts an angle measured in degrees to an approximately equivalent angle measured in radians. |
truncateNumber(Double number, Integer precision) |
Double |
Truncates a number using the specified precision. |
ulp(Double a) |
Double |
Returns the size of a ULP of the argument. |
Example 20-10 Time conversion example with floor
This example uses the floor
function to convert trip_time_in_secs
to minutes:
floor(trip_time_in_secs/60)
trip_time_in_seconds
is first divided by 60 to determine the number of minutes in the trip. The floor
function then rounds this number down and returns it as a double.