I decided to use NAN(also tried std::numeric_limits::quiet_NaN()) as default value for argument of the function, but when i tried to check it using std::isnan, it returned false. In the same time value was printed to console using qDebug() and i saw nan.
Also i tried to check for NAN using x != x rule. It worked for NAN != NAN, but got false for x != x.
Last try was to define NAN double variable inside of the function and try to check it using both methods, but it lead to the same results.
I cant understand what is wrong.
Example:
double abc = NAN;
qDebug()<< abc << (abc != abc) << std::isnan(abc);
Output:
nan false false
I didn't know that we are using -ffast-math in our project. That is what leads to the problem. Thank you for your attention and comments. There is no solution if you are using -ffast-math. You just need to look for another way to solve your problem (without NAN)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With