Math.sin()

Math.sin() returns the trigonometric sin value of an angle in radian.
Syntax
Math.sin(angle_in_radian)
Note that all input numbers are in Radians.

Here are some examples.
System.out.println(Math.sin(Math.PI));	//1.2246467991473532E-16
System.out.println(Math.sin(Math.PI/2));//1.0
System.out.println(Math.sin(2)); 	//0.9092974268256817
System.out.println(Math.sin(1.22));	//0.9390993563190676
System.out.println(Math.sin(-1.22)); 	//-0.9390993563190676
System.out.println(Math.sin(0)); 		// 0.0
We can use toRadians to convert degree value to radian.
Math.round() to rounds a floot or double data type to nearest integer value
System.out.println(Math.round((Math.sin(Math.toRadians(180)))));//0
System.out.println((Math.sin(Math.toRadians(180))));//1.2246467991473532E-16
System.out.println(Math.sin(Math.toRadians(90))); //1.0
System.out.println(Math.sin(Math.PI)); 		//1.2246467991473532E-16
System.out.println(Math.sin(Math.PI/2));	//1.0


All Math functions


plus2net.com



Post your comments , suggestion , error , requirements etc here




We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2020 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer