Java.lang.StrictMath.toRadians() Method



Description

The java.lang.StrictMath.toRadians() method converts an angle measured in degrees to an approximately equivalent angle measured in radians. The conversion from degrees to radians is generally inexact.

Declaration

Following is the declaration for java.lang.StrictMath.toRadians() method

public static double toRadians(double angdeg)

Parameters

angdeg − This is an angle, in degrees.

Return Value

This method returns the measurement of the angle angdeg in radians.

Exception

NA

Example

The following example shows the usage of java.lang.StrictMath.toRadians() method.

package com.tutorialspoint;

import java.lang.*;

public class StrictMathDemo {

   public static void main(String[] args) {

      double d1 = 60, d2 = 0.0;
   
      /* converts an angle in degrees to an 
         approximately equivalent angle measured in radians. */

      double radianValue = StrictMath.toRadians(d1); 
      System.out.println("value in radian of " + d1 + " = " + radianValue);
        
      radianValue = StrictMath.toRadians(d2); 
      System.out.println("value in radian of " + d2 + " = " + radianValue);
   }
}

Let us compile and run the above program, this will produce the following result −

value in radian of 60.0 = 1.0471975511965976
value in radian of 0.0 = 0.0
java_lang_strictmath.htm
Advertisements