<cmath> <ctgmath>

isgreaterequal

isgreaterequal(x,y)
函式
bool isgreaterequal (float x      , float y);bool isgreaterequal (double x     , double y);bool isgreaterequal (long double x, long double y);
是否大於或等於
返回 x 是否大於或等於 y

如果一個或兩個引數是 NaN,函式返回 false,但不會引發 FE_INVALID 異常(注意,在這種情況下,表示式 x>=y 可能會引發此類異常)。

在 C 語言中,這被實現為一個返回 int 值的宏。 xy 的型別都應為 floatdoublelong double
在 C++ 中,它透過針對每種浮點型別的函式過載實現,每個過載都返回一個 bool 值。

引數

x, y
要比較的值。

返回值

(x)>=(y) 相同
如果 x 大於或等於 y,則為 true (1)。
否則為 false (0)。

示例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/* isgreaterequal example */
#include <stdio.h>      /* printf */
#include <math.h>       /* isgreaterequal, log */

int main ()
{
  double result;
  result = log (10.0);

  if (isgreaterequal(result,0.0))
    printf ("log(10.0) is not negative");
  else
    printf ("log(10.0) is negative");

  return 0;
}

輸出

log(10.0) is not negative


另見