How to Remove the Infinity value in C++

Many folks out there will be interested to know how to remove the infinity value from the c++ or C# program.
Basic level programmers do have problems e.g(When they divide the number by 0 and the output is the infinity value). There are many different cases when you will find this problem. So to solve this problem i have created a simple method which tells you that the value entered is a infinity number or a finite value.

Just set the value in the parenthesis when calling a bool function and the return will be true or false according to answer.

public : bool Check_Infinity(double Y)


return (Y <= DBL_MAX && Y >= -DBL_MAX);



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s