isfinite() in C++

isfinite(): This function is available in the file cmath. This function checks if the given value is finite or not. A finite value is any floating-point value that is neither infinite nor NaN. It returns a non-zero value (true) if x is finite; and zero (false) otherwise.

Parameters: One parameter is required for this function.

arg: A floating-point value.

Syntax:

isfinite(arg)

For Example:

isfinite(10.99)  = > It returns true.

Approach

C++

#include <bits/stdc++.h>
using namespace std;

int main()
{
    double x = 10.99;

    cout << isfinite(x<< "\n";

    return 0;
}


No comments:

Post a Comment