Math Isgreaterequal Function - C++ Programming Tutorial
C++ Course / Math Functions / Math Isgreaterequal Function

Math Isgreaterequal Function

BLUF: Mastering Math Isgreaterequal Function is a critical step in becoming a proficient C++ developer. This lesson provides a deep dive into the syntax, performance considerations, and real-world applications of this concept.
Key Performance Insight: Math Isgreaterequal Function

C++ is renowned for its efficiency. Learn how Math Isgreaterequal Function enables low-level control and high-performance computing in the tutorial below.

The isgreaterequal function checks if the value of the first parameter is greater than or equal to the value of the second parameter. It will return 1 if the first parameter is greater or equal, otherwise it will return 0.

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

Syntax

Consider a pair of values 'x' and 'y'. The syntax is as follows:

Example

bool isgreaterequal(float x, float y);
bool isgreaterequal(double x, double y);
bool isgreaterequal(long double x, long double y);
bool isgreaterequal(Arithmetic x, Arithmetic y);

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.

Parameter

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

Return value

Parameter Return value
x>=y 1
x<=y or x = nan or y = nan 0

Example 1

Let's examine a basic scenario where both variables x and y are of identical data type.

Example

#include <iostream>
#include<math.h>
using namespace std;
int main()
{
  double x=8.7;
  double y=7.7;
  cout<<"Values of x and y are : "<<x<<","<<y<<'\n';
  cout<<"isgreaterequal(x,y) : "<<isgreaterequal(x,y);
  return 0;
}

Output:

Output

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

In this instance, the isgreaterequal method assesses that the value of x surpasses y. As a result, it outputs a value of 1.

Example 2

Let's examine a basic scenario where both variables x and y have distinct data types.

Example

#include <iostream>
#include<math.h>
using namespace std;
int main()
{
 double x=8.7;
 int y=7;
  cout<<"Values of x and y are : "<<x<<","<<y<<'\n';
  cout<<"isgreaterequal(x,y) : "<<isgreaterequal(x,y);
  return 0;
}

Output:

Output

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

In this instance, the isgreaterequal method establishes that the value of x exceeds y, resulting in a return value of 1.

Example 3

Let's explore a straightforward scenario where the value of x is NaN.

Example

#include <iostream>
#include<math.h>
using namespace std;
int main()
{
  double x=0.0/0.0;
 double y=8.0;
  cout<<"Values of x and y are : "<<x<<","<<y<<'\n';
  cout<<"isgreaterequal(x,y) : "<<isgreaterequal(x,y);
  return 0;
}

Output:

Output

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

In this instance, x is evaluated as NaN, resulting in the function outputting 0.

Input Required

This code uses input(). Please provide values below:

Logic Practice
Install Logic Practice
Add to home screen for a faster app-like experience