In this section we will study about the Match class of Java API.
Some basic math functions can be found in the Math class.
StrictMath class (not described here) may produce less accurate results and be slower,
but will produce absolutely identical results, bit for bit, on
StrictMath unless you need this very specific
kind of portability.
If you need numbers that exceed the range of
If you need to do exact decimal arithmetic, use
which gives complete control over precision and rounding, eg for financial calculations.
Assume following declarations
float f; double d, d1, d2; double ar; // angle in radians. x is any of int, long, float, or double.
Here is the detailed summary of Match class.
|Two common constants are defined in the Math class.|
|double||Math.E()||Value of e, 2.718282..., base of the natural logarithms.|
|double||Math.PI()||Value of pi, 3.14159265 ....|
|All trigonometric method parameters are measured in radians, the normal mathematical system of angles, and not in degrees, the normal human angular measurement system. Use the toRadians or toDegrees methods to convert between these systems, or use the knowledge that there are 2*PI radians in 360 degrees. In addition to those below, the arc functions are also available.|
|double||Math.sin(ar)||Returns the sine of ar.|
|double||Math.cos(ar)||Returns the cosine of ar.|
|double||Math.tan(ar)||Returns the tangent of ar.|