Python math.nan 定数

Python math 模块Python math モジュール

Python math.nan浮動小数点値 nan(not a number、数字ではありません)を返します。この値は有効な数値ではありません。

math.nanに相当しますfloat('nan')の出力。

構文

math.nan 定数の構文は次のとおりです:

math.nan

戻り値

浮動小数点数 nan を返します。

例

次の例は nan を返します:

例

# math パッケージをインポート
import math

# nan を出力
print (math.nan)

# nan の型を出力
print (type(math.nan))

出力結果:

nan
<class 'float'>

Python math 模块Python math モジュール

その他の拡張機能