isnan() in C++

isnan(): This function is available in the file cmath. This function returns whether a given parameter is NaN or not.This function returns a non-zero value (true) if x is a NaN value, and zero (false) otherwise.

Parameters: One parameter is required for this function.

arg: The floating-point value.

Syntax:

isnan(arg)

For Example:

isnan(10.5) = > It return false(0).

isnan(NAN) = > It return true.

Approach

C++

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

int main()
{
    float x = 10.5;
    cout << isnan(x<< "\n";
   
    return 0;
}


No comments:

Post a Comment