What are Mathematical Functions in Java?

Java supports basic mathematical functions through math class defined in the Java long package. These functions should be used as follows

math. Function _ name( );

Example: Double y = math. Sqrt (x) ;

Math Functions:

Function
Description

Sin (x)
Returns the sine value of x (x in radians)
Cos (x)
Returns the cosine value x (x in radians)
Tan (x)
Returns the tangent value of x (x in radians)
Asin (y)
Returns the angle whose sine is y
Acos (y)
Returns the angle whose cosine is y
Atan(y)
Returns the angle whose tangent is y
Pow (x,y)
Returns x raised to y (xy)
Exp (x)
Returns e raised x (ex)
Log (x)
Returns the natural logainthm of x
Sqrt (x)
Returns the square root of x
Ceil (x)
Returns the smallest whole numbers greater than or equal to x (rounding up)
Floor (x)
Returns the largest whole number less than or equal to x (rounding down)
Rint (x)
Returns the truncated value of x
Abs (a)
Returns the absolute value of a
Max (a,b)
Returns the maximum of a and b
Min (a,b)
Returns the minimum of a and b

Related

Java 6695353613641152265

Post a Comment

emo-but-icon

item