Вопрос

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