If I compile my program with -Ofast with clang, sometimes I will get an infinite float back, but isinf() and isfinite() don't work. U is a floating-point type, I (>=0) and wbits (>0) are integers.
auto const tmp(f * std::pow(U(2), -I * wbits));
std::cout << "??? " << tmp << " " << std::isinf(tmp) << std::endl;
and I get:
??? inf 0
Comparing tmp to INFINITY does not work, f > std::numeric_limits<U>::max() does not work. Doing bit-magic (reimplementing isinf()) would work, but I don't want to do this. Finally, why would std::pow() produce an infinite float when a negative exponent is provided?