isgreater

来自cppreference.com
< c‎ | numeric‎ | math
 
 
 
常用数学函数
函数
基本运算
(C99)
(C99)
(C99)
(C99)(C99)(C99)(C23)
最大/最小运算
(C99)
(C99)
指数函数
(C23)
(C99)
(C99)
(C23)
(C23)

(C99)
(C99)(C23)
(C23)
(C23)
幂函数
(C99)
(C23)
(C23)

(C99)
(C23)
(C23)
三角及双曲函数
(C23)
(C23)
(C23)
(C23)
(C99)
(C99)
(C99)
浮点数的临近整数
(C99)(C99)(C99)
(C99)

(C99)(C99)(C99)
(C23)(C23)(C23)(C23)
浮点数操作
(C99)(C99)
(C99)(C23)
(C99)
窄化运算
(C23)
(C23)
(C23)
(C23)
(C23)
(C23)
量与量指数函数
十进制重编码函数
全序与载荷函数
分类
(C99)
(C99)
(C99)
(C23)
isgreater
(C99)
(C99)
(C23)

误差及伽马函数
(C99)
(C99)
(C99)
(C99)
��型
宏常量
特殊浮点数值
(C99)(C23)
参数与返回值
错误处理
快速运算指示
 
在标头 <math.h> 定义
#define isgreater(x, y) /* 由实现定义 */
(C99 起)

确定浮点数 x 是否大于浮点数 y,而不设置浮点数异常。

目录

[编辑] 参数

x - 浮点数
y - 浮点数

[编辑] 返回值

x > y 则为非零整数,否则为 0

[编辑] 注解

若一或两个参数为 NaN,则内建的 operator> 对浮点数可能引发 FE_INVALID。此宏是 operator> 的“安静”版本。

[编辑] 示例

#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 The isgreater macro (第 TBD 页)
  • F.10.11 Comparison macros (第 TBD 页)
  • C17 标准(ISO/IEC 9899:2018):
  • 7.12.14.1 The isgreater macro (第 189 页)
  • F.10.11 Comparison macros (第 386-387 页)
  • C11 标准(ISO/IEC 9899:2011):
  • 7.12.14.1 The isgreater macro (第 259 页)
  • F.10.11 Comparison macros (第 531 页)
  • C99 标准(ISO/IEC 9899:1999):
  • 7.12.14.1 The isgreater macro (第 240 页)

[编辑] 参阅

(C99)
检查第一个浮点数实参是否小于第二个
(宏函数) [编辑]
isgreater 的 C++ 文档