_finite, _finitel

提供: RAD Studio
移動先: 案内検索

float.h:インデックス への移動


ヘッダーファイル

float.h

カテゴリ

演算ルーチン

プロトタイプ

int _finite(double d);

int _finitel(long double ld);

説明

指定された倍精度小数点値 d が有限かどうかを決定します。

_finitel は long double バージョンで,long double 引数を受け取ります。

戻り値

引数が有限の場合は 0 以外を返し,そうでない場合は 0 を返します。

コード例

#include <float.h>
#include <stdio.h>

/* Compare a and b if both have finite values */
int compare(double a, double b)
{
  /* Only if both are finite. Otherwise give an indefinite ordering */
  if (_finite(a) && _finite(b)) {
    if (a < b)
      return -1;
    else if (a > b)
      return 1;
    else
      return 0;
  }
  else
    return -1;
}

移植性

POSIX Win32 ANSI C ANSI C++

_finite

+

_finitel

+