- Java.lang - Void
- Java.lang - Throwable
- Java.lang - ThreadLocal
- Java.lang - ThreadGroup
- Java.lang - Thread
- Java.lang - System
- Java.lang - StringBuilder
- Java.lang - StringBuffer
- Java.lang - String
- Java.lang - StrictMath
- Java.lang - StackTraceElement
- Java.lang - Short
- Java.lang - SecurityManager
- Java.lang - RuntimePermission
- Java.lang - Runtime
- Java.lang - ProcessBuilder
- Java.lang - Process
- Java.lang - Package
- Java.lang - Object
- Java.lang - Number
- Java.lang - Math
- Java.lang - Long
- Java.lang - Integer
- Java.lang - InheritableThreadLocal
- Java.lang - Float
- Java.lang - Enum
- Java.lang - Double
- Java.lang - Compiler
- Java.lang - ClassLoader
- Java.lang - Class
- Java.lang - Character.UnicodeBlock
- Java.lang - Character.Subset
- Java.lang - Character
- Java.lang - Byte
- Java.lang - Boolean
- Java.lang - Home
Java.lang Package extras
Java.lang Package Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Java.lang.Math Class
Introduction
The java.lang.Math class contains methods for performing basic numeric operations such as the elementary exponential, logarithm, square root, and trigonometric functions.
Class Declaration
Following is the declaration for java.lang.Math class −
pubpc final class Math extends Object
Field
Following are the fields for java.lang.Math class −
static double E − This is the double value that is closer than any other to e, the base of the natural logarithms.
static double PI − This is the double value that is closer than any other to pi, the ratio of the circumference of a circle to its diameter.
Class methods
Sr.No. | Method & Description |
---|---|
1 | This method returns the absolute value of a double value. |
2 | This method returns the absolute value of a float value. |
3 | This method returns the absolute value of an int value. |
4 | This method returns the absolute value of a long value. |
5 | This method returns the arc cosine of a value; the returned angle is in the range 0.0 through pi. |
6 | This method returns the arc sine of a value; the returned angle is in the range -pi/2 through pi/2. |
7 | This method returns the arc tangent of a value; the returned angle is in the range -pi/2 through pi/2. |
8 | This method returns the angle theta from the conversion of rectangular coordinates (x, y) to polar coordinates (r, theta). |
9 | This method returns the cube root of a double value. |
10 | This method returns the smallest (closest to negative infinity) double value that is greater than or equal to the argument and is equal to a mathematical integer. |
11 | This method returns the first floating-point argument with the sign of the second floating-point argument. |
12 | This method returns the first floating-point argument with the sign of the second floating-point argument. |
13 | This method returns the trigonometric cosine of an angle. |
14 | This method returns the hyperbopc cosine of a double value. |
15 | This method returns Euler s number e raised to the power of a double value. |
16 | This method returns ex -1. |
17 | This method returns the largest (closest to positive infinity) double value that is less than or equal to the argument and is equal to a mathematical integer. |
18 | This method returns the unbiased exponent used in the representation of a double. |
19 | This method returns the unbiased exponent used in the representation of a float. |
20 | This method returns sqrt(x2 +y2) without intermediate overflow or underflow. |
21 | This method computes the remainder operation on two arguments as prescribed by the IEEE 754 standard. |
22 | This method returns the natural logarithm (base e) of a double value. |
23 | This method returns the base 10 logarithm of a double value. |
24 | This method returns the natural logarithm of the sum of the argument and 1. |
25 | This method returns the greater of two double values. |
26 | This method returns the greater of two float values. |
27 | This method returns the greater of two int values. |
28 | This method returns the greater of two long values. |
29 | This method returns the smaller of two double values. |
30 | This method returns the smaller of two float values. |
31 | This method returns the smaller of two int values. |
32 | This method returns the smaller of two long values. |
33 | This method returns the floating-point number adjacent to the first argument in the direction of the second argument. |
34 | This method returns the floating-point number adjacent to the first argument in the direction of the second argument. |
35 | This method returns the floating-point value adjacent to d in the direction of positive infinity. |
36 | This method returns the floating-point value adjacent to f in the direction of positive infinity. |
37 | This method returns the value of the first argument raised to the power of the second argument. |
38 | This method returns a double value with a positive sign, greater than or equal to 0.0 and less than 1.0. |
39 | This method returns the double value that is closest in value to the argument and is equal to a mathematical integer. |
40 | This method returns the closest long to the argument. |
41 | This method returns the closest int to the argument. |
42 | This method returns d × 2scaleFactor rounded as if performed by a single correctly rounded floating-point multiply to a member of the double value set. |
43 | This method return f × 2scaleFactor rounded as if performed by a single correctly rounded floating-point multiply to a member of the float value set. |
44 | This method returns the signum function of the argument; zero if the argument is zero, 1.0 if the argument is greater than zero, -1.0 if the argument is less than zero. |
45 | This method returns the signum function of the argument; zero if the argument is zero, 1.0f if the argument is greater than zero, -1.0f if the argument is less than zero. |
46 | This method returns the hyperbopc sine of a double value. |
47 | This method Returns the hyperbopc sine of a double value. |
48 | This method returns the correctly rounded positive square root of a double value. |
49 | This method returns the trigonometric tangent of an angle.r |
50 | This method returns the hyperbopc tangent of a double value. |
51 | This method converts an angle measured in radians to an approximately equivalent angle measured in degrees. |
52 | This method converts an angle measured in degrees to an approximately equivalent angle measured in radians. |
53 | This method returns the size of an ulp of the argument. |
54 | This method returns the size of an ulp of the argument. |
Methods inherited
This class inherits methods from the following classes −
java.lang.Object