The java.lang.StrictMath.toRadians() method of StrictMath class in Java is used to accept an angle measured in degrees as a parameter and returns its approximately equivalent angle measured in radians. So basically it converts degree to radians. This conversion is generally inexact.
Syntax:
public static double toRadians(double deg)
Parameters: This function accepts a single parameter deg which refers to an angle in degrees which is to be converted to its equivalent radians.
Return Values: This method returns the measurement of the angle passed as a parameter, in radians.
Examples:
Input : 120 Output : 2.0943951023931953 Input : 0.00087104 Output : 1.5202515916571408E-5
Below programs illustrate the java.lang.StrictMath.toRadians() method in Java :
Program 1:
// Java Program to illustrate // StrictMath.toRadians() function import java.io.*; import java.lang.*; class GFG { public static void main(String[] args) { double deg = 108.478; double rad = StrictMath.toRadians(deg); System.out.println("Value in radian of " + deg + " degrees is " + rad); } } |
Value in radian of 108.478 degrees is 1.8932982659784086
Program 2:
// Java Program to illustrate StrictMath.toRadians() // function import java.io.*; import java.lang.*; class GFG { public static void main(String[] args) { double deg = 360.0; double rad = StrictMath.toRadians(deg); System.out.println("Value in radian of " + deg + " degrees is " + rad); } } |
Value in radian of 360.0 degrees is 6.283185307179586
Reference: https://docs.oracle.com/javase/8/docs/api/java/lang/StrictMath.html#toRadians()
Attention reader! Don’t stop learning now. Get hold of all the important Java and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready.
Recommended Posts:
- Java toRadians() method with Example
- toDegrees() and toRadians() in Java
- Java.lang.StrictMath class in Java | Set 1
- Java.lang.StrictMath class in Java | Set 2
- StrictMath log1p() Method in Java
- StrictMath IEEEremainder() Method in Java
- StrictMath nextAfter() Method in Java
- StrictMath tan() Method in Java
- StrictMath atan2() Method in Java
- StrictMath hypot() Method in Java
- StrictMath acos() Method in Java
- StrictMath asin() Method in Java With Examples
- StrictMath atan() Method in Java
- StrictMath cbrt() Method in Java
- StrictMath ceil() Method in Java with Examples
- StrictMath cos() Method in Java with Examples
- StrictMath exp() Method in Java
- StrictMath cosh() Method in Java
- StrictMath expm1() Method in Java With Examples
- StrictMath floor() Method in Java
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

