Groovy - Numbers toDegrees()


Advertisements

The method converts the argument value to degrees.

Syntax

double toDegrees(double d)

Parameters

d - A double data type.

Return Value

This method returns a double value.

Example

Following is an example of the usage of this method −

class Example { 
   static void main(String[] args) { 
      double x = 45.0; 
      double y = 30.0;
		
      System.out.println( Math.toDegrees(x) ); 
      System.out.println( Math.toDegrees(y) ); 
   } 
}

When we run the above program, we will get the following result −

2578.3100780887044 
1718.8733853924698
groovy_numbers.htm
Advertisements