Groovy - atan ()

Il metodo restituisce l'arcotangente del valore double specificato.

Sintassi

double atan(double d)

Parametri

d - Questo metodo accetta un valore di tipo di dati double.

Valore di ritorno

Questo metodo Restituisce l'arcotangente del valore double specificato.

Esempio

Di seguito è riportato un esempio dell'utilizzo di questo metodo:

class Example {
   static void main(String[] args) {
      double degrees = 45.0;
      double radians = Math.toRadians(degrees);  
		
      System.out.format("The value of pi is %.4f%n", Math.PI);
      System.out.format("The arctangent of %.4f is %.4f degrees %n", Math.cos(radians),
         Math.toDegrees(Math.atan(Math.sin(radians))));  
   } 
}

Quando eseguiamo il programma sopra, otterremo il seguente risultato:

The value of pi is 3.1416 
The arctangent of 0.7071 is 35.2644 degrees