VOOZH about

URL: https://www.geeksforgeeks.org/java/strictmath-sin-method-in-java/

⇱ StrictMath sin() Method in Java - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

StrictMath sin() Method in Java

Last Updated : 3 Aug, 2018
The java.lang.StrictMath.sin() is an in-built function in Java which returns the trigonometric sine of an angle. Syntax:
public static double sin(double ang)
Parameters: This function accepts a single parameter ang which is a double variable which represents an angle (in radians) whose trigonometric tangent is to be returned by the function. Return Value: This method returns the sine of the angle passed as argument to the function. The following cases are considered :
  • The function returns NaN if the argument is NaN or infinity.
  • The function returns zero with the sign same as that of the argument if the argument is zero.
Examples:
Input : ang = 0.5235987755982988(30 degree)
Output : 0.49999999999999994

Input : ang = 0.7853981633974483(45 degree)
Output : 0.7071067811865475
Below programs illustrate the working of java.lang.StrictMath.sin() function in Java: Program 1:
Output:
Sine value of 60 degrees : 0.8660254037844386
Program 2:
Output:
1.3461375454781863
Sine value of 77.128 degrees : 0.9748701783788553
Reference: https://docs.oracle.com/javase/8/docs/api/java/lang/StrictMath.html#sin()
Comment