Namespaces
Variants

isgreater

From cppreference.net
< c ‎ | numeric ‎ | math
Common mathematical functions
Functions
Basic operations
(C99)
(C99)
(C99)
(C99) (C99) (C99) (C23)
Maximum/minimum operations
Exponential functions
Power functions
Trigonometric and hyperbolic functions
Nearest integer floating-point
(C99) (C99) (C99)
(C23) (C23) (C23) (C23)
Floating-point manipulation
Narrowing operations
(C23)
(C23)
(C23)
(C23)
(C23)
(C23)
Quantum and quantum exponent
Decimal re-encoding functions
Total order and payload functions
Classification
Error and gamma functions
(C99)
(C99)
(C99)
(C99)
Types
Macro constants
Special floating-point values
Arguments and return values
Error handling
Fast operation indicators
ヘッダーで定義 <math.h>
#define isgreater(x, y) /* implementation defined */
(C99以降)

浮動小数点数 x が浮動小数点数 ( y ) より大きいかどうかを判定し、浮動小数点例外を設定しません。

目次

パラメータ

x - 浮動小数点値
y - 浮動小数点値

戻り値

x > y の場合、非ゼロの整数値、 0 それ以外の場合。

注記

組み込みの operator > は、引数の一方または両方がNaNの場合、 FE_INVALID を設定する可能性があります。この関数は operator > の「quiet」バージョンです。

#include <math.h>
#include <stdio.h>
int main(void)
{
    printf("isgreater(2.0,1.0)      = %d\n", isgreater(2.0, 1.0));
    printf("isgreater(1.0,2.0)      = %d\n", isgreater(1.0, 2.0));
    printf("isgreater(INFINITY,1.0) = %d\n", isgreater(INFINITY, 1.0));
    printf("isgreater(1.0,NAN)      = %d\n", isgreater(1.0, NAN));
    return 0;
}

出力例:

isgreater(2.0,1.0)      = 1
isgreater(1.0,2.0)      = 0
isgreater(INFINITY,1.0) = 1
isgreater(1.0,NAN)      = 0

参考文献

  • C23規格 (ISO/IEC 9899:2024):
  • 7.12.14.1 isgreaterマクロ (p: TBD)
  • F.10.11 比較マクロ (p: TBD)
  • C17 standard (ISO/IEC 9899:2018):
  • 7.12.14.1 The isgreater macro (p: 189)
  • F.10.11 Comparison macros (p: 386-387)
  • C11規格 (ISO/IEC 9899:2011):
  • 7.12.14.1 isgreaterマクロ (p: 259)
  • F.10.11 比較マクロ (p: 531)
  • C99規格 (ISO/IEC 9899:1999):
  • 7.12.14.1 isgreaterマクロ (p: 240)

関連項目

(C99)
第1浮動小数点引数が第2引数より小さいかどうかをチェックする
(関数マクロ)
C++ documentation for isgreater