Python math.degrees() メソッド

Python math 模块Python math モジュール

Python math.degrees(x)このメソッドは角度 x をラジアンから度に変換します。

PI(3.14...)ラジアンは180度に等しく、つまり1ラジアンは57.2957795度に等しくなります。

math.radians()このメソッドは度の値をラジアンに変換します。

Python バージョン: 2.3

構文

math.degrees() メソッドの構文は次のとおりです:

math.degrees(x)

パラメータの説明:

  • x-- 必須、数値。x が数値でない場合、TypeError を返します。

戻り値

角度を表す浮動小数点数を返します。

例

次の例では、さまざまなラジアンを度に変換した結果を返します:

例

# math モジュールをインポート
import math

# ラジアンを度に変換して出力
print (math.degrees(8.90))
print (math.degrees(-20))
print (math.degrees(1))
print (math.degrees(90))

出力結果:

509.9324376664327
-1145.9155902616465
57.29577951308232
5156.620156177409

Python math 模块Python math モジュール

その他の拡張