nan

Section: C Library Functions (3)
Updated: 2026-02-08
Index JM Home Page roff page
 

名前

nan, nanf, nanl - 無効値 ('Not a Number') を返す  

ライブラリ

数学ライブラリ (libm,~-lm)  

書式

#include <math.h>

double nan(const char *tagp);
float nanf(const char *tagp);
long double nanl(const char *tagp);

glibc 向けの機能検査マクロの要件 (feature_test_macros(7) 参照):

nan(), nanf(), nanl():

    _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
 

説明

これらの関数は、SIGFPE シグナルなしの無効値 (NaN) を示す表現を返す (どの表現を使用するかは tagp で指定する)。SIGFPE シグナルなしの NaN をサポートしていない実装では 0 を返す。

nan("char-sequence") を呼び出すのは、以下と等価である。

strtod("NAN(char-sequence)", NULL);

同様に、 nanf() や nanl() を呼び出すのは、 strtof() や strtold() を呼ぶのと同じである。

引数 tagp の使い方は規定されていない。 IEEE 754 準拠のシステムでは、NaN にも複数の表現が存在し、 tagp はその選択に使用される。 他のシステムでは、何の意味もないかもしれない。  

属性

この節で使用されている用語の説明については、 attributes(7) を参照。
インターフェース属性値
nan(), nanf(), nanl() Thread safetyMT-Safe locale
 

標準規格

C11, POSIX.1-2008.

See also IEC 559 and the appendix with recommended functions in IEEE 754/IEEE 854.  

歴史

glibc 2.1. C99, POSIX.1-2001.  

関連項目

isnan(3), strtod(3), math_error(7)


 

Index

名前
ライブラリ
書式
説明
属性
標準規格
歴史
関連項目

This document was created by man2html, using the manual pages.