سؤال

If in C++ I got the any of the following values, how to verify or compare them?

float pinf = std::numeric_limits<float>::infinity();
double dpinf = std::numeric_limits<double>::infinity();

float ninf = -std::numeric_limits<float>::infinity();
float NaN = std::numeric_limits<float>::quiet_NaN();
float nNaN = -std::numeric_limits<float>::quiet_NaN();
double dNaN = std::numeric_limits<double>::quiet_NaN();
هل كانت مفيدة؟

المحلول

You can use std::fpclassify or any of the related functions.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top