首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

isgreaterequal

在头文件<math.h>中定义

?

?

#define isgreaterequal(x, y) /* implementation defined */

?

(since C99)

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

参数

x

-

浮点值

y

-

浮点值

返回值

非零整数值x >= y?0?否则。

笔记

如果其中一个或两个参数都是NaN,则operator>=可能会引发内置的浮点数FE_INVALID。这个功能是一个“安静”的版本operator>=

代码语言:javascript
复制
#include <stdio.h>
#include <math.h>
 
int main(void)
{
    printf("isgreaterequal(2.0,1.0)      = %d\n", isgreaterequal(2.0,1.0));
    printf("isgreaterequal(1.0,2.0)      = %d\n", isgreaterequal(1.0,2.0));
    printf("isgreaterequal(1.0,1.0)      = %d\n", isgreaterequal(1.0,1.0));
    printf("isgreaterequal(INFINITY,1.0) = %d\n", isgreaterequal(INFINITY,1.0));
    printf("isgreaterequal(1.0,NAN)      = %d\n", isgreaterequal(1.0,NAN));
 
    return 0;
}

可能的输出:

代码语言:javascript
复制
isgreaterequal(2.0,1.0)      = 1
isgreaterequal(1.0,2.0)      = 0
isgreaterequal(1.0,1.0)      = 1
isgreaterequal(INFINITY,1.0) = 1
isgreaterequal(1.0,NAN)      = 0

参考

  • C11标准(ISO / IEC 9899:2011):
    • 7.12.14.2 isgreaterequal宏(p:259-260)
    • F.10.11比较宏(p:531)
  • C99标准(ISO / IEC 9899:1999):
    • 7.12.14.2 isgreaterequal宏(p:240-241)

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com