Home >>Java Math Methods
The Java Math Methods or the math class basically possesses many methods that generally permits the programmer to execute mathematical tasks on the numbers.
Here are all the math functions or methods that are used in the Java language. This below depicted table consists of the method name, description and the return type:
Method | Description | Return Type |
---|---|---|
abs(x) | This method is generally used to return the absolute value of x | double|float|int|long |
acos(x) | This method is generally used to return the arccosine of x, in radians | double |
asin(x) | This method is generally used to return the arcsine of x, in radians | double |
atan(x) | This method is generally used to return the arctangent of x as a numeric value between -PI/2 and PI/2 radians | double |
atan2(y,x) | This method is generally used to return the angle theta from the conversion of rectangular coordinates (x, y) to polar coordinates (r, theta). | double |
cbrt(x) | This method is generally used to return the cube root of x | double |
ceil(x) | This method is generally used to return the value of x rounded up to its nearest integer | double |
copySign(x, y) | This method is generally used to return the first floating point x with the sign of the second floating point y | double |
cos(x) | This method is generally used to return the cosine of x (x is in radians) | double |
cosh(x) | This method is generally used to return the hyperbolic cosine of a double value | double |
exp(x) | This method is generally used to return the value of Ex | double |
expm1(x) | This method is generally used to return ex -1 | double |
floor(x) | This method is generally used to return the value of x rounded down to its nearest integer | double |
getExponent(x) | This method is generally used to return the unbiased exponent used in x | int |
hypot(x, y) | This method is generally used to return sqrt(x2 +y2) without intermediate overflow or underflow | double |
IEEEremainder(x, y) | This method is generally used to compute the remainder operation on x and y as it is prescribed by the IEEE 754 standard | double |
log(x) | This method is generally used to return the natural logarithm (base E) of x | double |
log10(x) | This method is generally used to return the base 10 logarithm of x | double |
log1p(x) | This method is generally used to return the natural logarithm (base E) of the sum of x and 1 | double |
max(x, y) | This method is generally used to return the number with the highest value | double|float|int|long |
min(x, y) | This method is generally used to return the number with the lowest value | double|float|int|long |
nextAfter(x, y) | This method is generally used to return the floating point number adjacent to x in the direction of y | double|float |
nextUp(x) | This method is generally used to return the floating point value adjacent to x in the direction of positive infinity | double|float |
pow(x, y) | This method is generally used to return the value of x to the power of y | double |
random() | This method is generally used to return a random number between 0 and 1 | double |
round(x) | This method is generally used to return the value of x rounded to its nearest integer | int |
rint(x) | This method is generally used to return the double value that is closest to x and equal to a mathematical integer | double |
signum(x) | This method is generally used to return the sign of x | double |
sin(x) | This method is generally used to return the sine of x (x is in radians) | double |
sinh(x) | This method is generally used to return the hyperbolic sine of a double value | double |
sqrt(x) | This method is generally used to return the square root of x | double |
tan(x) | This method is generally used to return the tangent of an angle | double |
tanh(x) | This method is generally used to return the hyperbolic tangent of a double value | double |
toDegrees(x) | This method is generally used to convert an angle that is measured in radians to an approx. equivalent angle measured in the degrees | double |
toRadians(x) | This method is generally used to convert an angle measured in degrees to an approx. angle measured in radians | double |
ulp(x) | This method is generally used to return the size of the unit of least precision (ulp) of x | double|float |