0% found this document useful (0 votes)
9 views2 pages

Mathematical Library Methods

The document outlines various mathematical library methods, including their functions, syntax, arguments, return types, and examples. Key functions include Math.min, Math.max, Math.pow, Math.sqrt, and trigonometric functions such as Math.sin and Math.cos. Each method is described with its purpose and how to use it in programming.

Uploaded by

Vasanth
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views2 pages

Mathematical Library Methods

The document outlines various mathematical library methods, including their functions, syntax, arguments, return types, and examples. Key functions include Math.min, Math.max, Math.pow, Math.sqrt, and trigonometric functions such as Math.sin and Math.cos. Each method is described with its purpose and how to use it in programming.

Uploaded by

Vasanth
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Mathematical Library Methods

No. of
Function Use Syntax Argument Return Type Example
& type

To find the <Return data type><variable> int/double as


2 int n=Math.min(4,6)
Math.min minimum of two = Function name (argument 1 , per argument
int/double double n=Math.min(4.6,2.8)
numbers argument 2); given

To find the <Return data type><variable> int/double as


2 int n=Math.max(4,6)
Math.max maximum of two = Function name (argument 1 , per argument
int/double double n=Math.max(4.6,2.8)
numbers argument 2); given
<Return data type><variable>
2 double d=Math.pow(2.0,3.0)
Math.pow To find an = Function name (number 1 , double
double double d=Math.pow(5.0,-2.0)
number 2);
<Return data type><variable> double n=Math.sqrt(4.0)
1
Math.sqrt To find √a = Function name (positive double double n=Math.sqrt(-4.0)
double
number) will return NaN (Not a Number)

<Return data type><variable>


1 double n=Math.cbrt(27.0)
Math.cbrt To find cube root = Function name double
double double n=Math.cbrt(-3.375)
(positive/negative number)
<Return data type><variable>
To find natural 1
Math.log = Function name (positive double double x=Math.log(6.25)
logarithm double
number)
To find the
int/double as
absolute value i.e <Return data type><variable> 1 int n=Math.abs(3)
Math.abs per argument
magnitude = Function name (number ); int/double double d=Math.abs(-9.99)
given
without sign

To find the value


<Return data type><variable> 1 System.out.println(Math.round(8.49))
Math.round in rounded-off int
= Function name (argument ); double ;
form
To find nearest
integer. Returns <Return data type><variable> 1
Math.rint double System.out.println(Math.rint(8.5));
integer in double = Function name (argument ); double
data type

Return higher <Return data type><variable> 1


Math.ceil double System.out.println(Math.ceil(8.5));
integer = Function name (argument ); double

Return lower <Return data type><variable> 1


Math.floor double System.out.println(Math.floor(8.5));
integer = Function name (argument ); double
Returns a random
<Return data type><variable>
Math.random number between 0 NIL double double d=Math.random();
= Function name ( );
and 1
Math.PI To invoke 22/7 Maht.PI NIL double double d=Math.PI;
To convert an <data type><variable2> =
1 double deg=45;
Math.toRadians angle in degrees to <Math.toRadians><variable1> double
double double rad = Math.toRadians(deg);
radians ;
To convert an <data type><variable2> =
Math.toDegree 1 double rad=Math.PI;
angle in radians to Math.<arc double
s double double deg = Math.toDegrees(rad);
degrees funtion><variable1>;

To find the
Math.sin <Return data type><variable>
trigonometrical 1 double rad=(22.0/(7.0*180))*a;
Math.cos = <Function name ( angle in double
ratio, if the angle double double d=Math.cos(rad);
Math.tan radian)>;
is known

To find an angle, if
Math.asin <Return data type><variable>
the 1 double k=Math.asin(0.5);
Math.acos = <Function name ( value in double
trigonometrical double double d=(k*7.0*180.0)/22.0;
Math.atan radian)>;
ratio is known

You might also like