![]() |
VOOZH | about |
Java.lang.Math Class methods help to perform numeric operations like square, square root, cube, cube root, exponential and trigonometric operations.
Declaration
public final class Math
extends Object
Math class consists of methods that can perform mathematical operations and can make long calculations a bit easier. Let us check the method provided in the Math class.
| Method | Description |
|---|---|
| sin | Returns the trigonometric value of the sine of an angle. |
| cos | Returns the trigonometric value of the cosine of an angle. |
| tan | Returns the trigonometric value of the tangent of an angle. |
| asin | Returns the trigonometric value of the arc sine of an angle. |
| acos | Returns the trigonometric value of the arc cosine of an angle. |
| atan | Returns the trigonometric value of the arc tangent of an angle. |
| toRadians | Convert value in degrees to value in radians |
| toDegrees | Convert value in radians to value in degrees |
| exp | Returns Euler's number e raised to the power of a double value |
| log | Returns the natural logarithm (base e) of a double value |
| log10 | Returns the base 10 logarithms of a double value |
| sqrt | Returns the correct rounded positive square root of a double value |
| cbrt | Returns the cube root of a double value |
| IEEEremainder | Computes the remainder operation on two arguments as instructed by the IEEE 754 standard. |
| ceil | Returns the smallest double value that is greater than or equal to the argument. It is a fixed mathematical integer |
| floor | Returns the smallest double value that is less than or equal to the argument. It is a fixed mathematical integer. |
| rint | Returns the double value that is closest in value to the argument and is equal to a mathematical integer |
| atan2 | Returns the angle theta from the conversion of rectangular coordinates (x, y) to polar coordinates (r, theta) |
| pow | Returns(pow(a,b)) the value of ab. |
| round | Returns the closest int to the argument, with ties rounding to positive infinity |
| random | Returns a double value with a positive sign, in the range [0.0, 1.0). |
| addExact | Returns the sum of its arguments, throwing an exception if the result overflows a value. |
| subtractExact | Returns the difference of its arguments, throwing an exception if the result overflows a value. |
| multiplyExact | Returns the product of the arguments, throwing an exception if the result overflows a value. |
| incrementExact | Returns the argument value incremented by 1 and throws an exception if the value overflows. |
| decrementExact | Returns the argument value decremented by 1 and throws an exception if the value overflows. |
| negateExact | Returns the negation of the argument and throws an exception if the value overflows. |
| toIntExact | Returns the value of the long argument and throws an exception if the int overflows. |
| floorDiv | Returns the largest (closest to positive infinity) long value that is less than or equal to the algebraic quotient |
| floorMod | Returns the floor modulus of the arguments |
| abs | Return the absolute value |
| max | Returns the maximum out of the two arguments |
| min | Returns the minimum out of the two arguments |
| ulp | Returns the size of an ulp of the argument. |
| signum | Returns value 0,1 and -1 depending upon if the argument is equal, greater, or less than zero respectively. |
| sinh | Returns the hyperbolic sine of the value. |
| cosh | Returns the hyperbolic cosine of the value. |
| tanh | Returns the hyperbolic sine of the value. |
| hypot | Returns the hyperbolic tangent of the value. |
| expm1 | Returns ex-1 |
| log1p | Returns the natural logarithm of the sum of the argument and 1 |
| copySign | Returns the first value argument with the sign of the second value argument |
| getExponent | Returns the unbiased exponent used in the representation of a value |
| nextAfter | Returns the floating-point number adjacent to the first argument in the direction of the second argument. |
| nextUp | Returns the floating-point value adjacent to d in the direction of positive infinity. |
| nextDown | Returns the floating-point value adjacent to d in the direction of negative infinity. |
| scalb | Returns f × 2scaleFactor rounded as if performed by a single correctly rounded floating-point multiplied to a member of the value set. |
i is 7 j is -9 |7| is 7 |-9| is 9 72.3 is approximately 72 0.34 is approximately 0 The ceiling of 72.3 is 73.0 The ceiling of 0.34 is 1.0 The floor of 72.3 is 72.0 The floor of 0.34 is 0.0 min(7,-9) i...
NaN's argument: A constant holding a Not-a-Number (NaN) value of type double. It is equivalent to the value returned by Double.longBitsToDouble(0x7ff8000000000000L).