Reputation: 63
I am trying to check, if a variable is not a number. I tried to use std::isnan()
for that.
Here's the code that I thought would work:
#include <iostream>
#include <cstddef>
#include <cmath>
int main()
{
int num = 1;
if (std::isnan(num))
{
std::cout << num << " is a Number" << std::endl;
}
else
{
std::cout << num << " is a Number" << std::endl;
}
}
The error it is giving is the following:
"fpclassify": Ambiguous call of an overloaded function
I can't understand why that won't work as expected, seen on many websites as examples.
Here's also a screenshot of everything:
Upvotes: 0
Views: 40