Groovy - 數字 toDegrees()



此方法將引數值轉換為角度。

語法

double toDegrees(double d)

引數

d - 一個雙精度資料型別。

返回值

此方法返回一個雙精度值。

示例

以下是使用此方法的一個示例 -

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) ); 
   } 
}

當我們執行以上程式時,我們將獲得以下結果 -

2578.3100780887044 
1718.8733853924698
groovy_numbers.htm
廣告
© . All rights reserved.