トップページ > キーワード検索 > ERANGE
C言語規格
C言語(その他)
プログラム
その他
ERANGE
機能 値域エラーを表す。
値域エラーとは、値が表現できる範囲を超えている事を表す。

値域エラーは外部変数のerrnoに格納される。
定義 #include <errno.h>

ERANGE
実装例
#include <errno.h>
#include <math.h>
#include <stdio.h>

int main(void)
{
    pow( 10, 500 );  /* pow関数の計算結果がdouble型の扱える範囲を超えている */
                     /* そのため外部変数errnoに ERANGE が格納される         */
    if (errno == ERANGE) {
        printf("Error=ERANGE\n");
    }
    
    return 0;
}
実行結果
Error=ERANGE





inserted by FC2 system