Chapter 16: Exploring java.lang 419
The next methods take as a parameter the result of a transcendental function and return,
in radians, the angle that would produce that result. They are the inverse of their non-arc
companions.
Method Description
static double asin(doublearg) Returns the angle whose sine is specified byarg.
static double acos(doublearg) Returns the angle whose cosine is specified byarg.
static double atan(doublearg) Returns the angle whose tangent is specified byarg.
static double atan2(doublex, doubley) Returns the angle whose tangent isx/y.
The next methods compute the hyperbolic sine, cosine, and tangent of an angle.
Method Description
static double sinh(doublearg) Returns the hyperbolic sine of the angle specified byarg.
static double cosh(doublearg) Returns the hyperbolic cosine of the angle specified byarg.
static double tanh(doublearg) Returns the hyperbolic tangent of the angle specified byarg.
Exponential Functions
Mathdefines the following exponential methods:
Method Description
static double cbrt(doublearg) Returns the cube root ofarg.
static double exp(doublearg) Returns e to thearg.
static double expm1(doublearg) Returns e to thearg–1
static double log(doublearg) Returns the natural logarithm ofarg.
static double log10(doublearg) Returns the base 10 logarithm forarg.
static double log1p(doublearg) Returns the natural logarithm forarg+1.
static double pow(doubley, doublex) Returnsyraised to thex; for example, pow(2.0, 3.0)
returns 8.0.
static double scalb(doublearg, intfactor) Returnsval× 2factor. (Added by Java SE 6.)
static float scalb(floatarg, intfactor) Returnsval× 2factor. (Added by Java SE 6.)
static double sqrt(doublearg) Returns the square root ofarg.
Rounding Functions
TheMathclass defines several methods that provide various types of rounding operations.
They are shown in Table 16-16. Notice the twoulp( )methods at the end of the table. In this
context,ulpstands forunits in the last place.It indicates the number of units between a value
and the next higher value. It can be used to help assess the accuracy of a result.