C++ Math isgreaterequal()

Last Updated : 16 May 2026

Math isgreaterequal() Function

In C++, the isgreaterequal() function is defined in the <cmath> or <math.h> header file and is used to determine whether the first argument is greater than or equal to the second argument. If the first value is greater than or equal to the second value, the function returns 1; otherwise, it returns 0.

The isgreaterequal() function supports float, double, long double, and other arithmetic data types.

Note: If one or both the arguments of a function are NAN then it returns 0.

Syntax

It has the following syntax.

Note: The arithmetic type can be of any type. It can be float, double, long double or int. If the type of any argument is integer then it is cast to double.

Parameters

(x,y): The values which we want to compare.

Return value

ParameterReturn value
x>=y1
x<=y or x = nan or y = nan0

Examples of isgreaterequal() Function

Here, we are going to discuss several examples to demonstrate the isgreaterequal() Function.

Example 1: Compare Two Values of the Same Data Type Using isgreaterequal()

This example demonstrates how the isgreaterequal() function compares two floating-point values of the same type.

Output:

Values of x and y are: 8.7,7.7
isgreaterequal(x,y) :1

Explanation:

In this example, isgreaterequal() function determines that the value of x is greater than y. Therefore, it returns 1.

Example 2: Compare Values of Different Data Types Using isgreaterequal()

This example demonstrates how the isgreaterequal() function behaves when the values are of different data types.

Output:

Values of x and y are : 8.7,7
isgreaterequal(x,y) : 1

Explanation:

In this example, isgreaterequal() function determines that the value of x is greater than y. Therefore, it returns 1.

Example 3: Compare a NaN Value Using isgreaterequal()

This example demonstrates how the isgreaterequal() function behaves when one of the values is NaN (Not a Number).

Output:

Values of x and y are : nan,8.0
isgreaterequal(x,y) : 0

Explanation:

In this example, the value of x is NAN. Therefore, the function returns 0.