https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117406
Bug ID: 117406 Summary: std::ilogb should return INT_MAX when argument is infinite also for 16-bit floats Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: pkeir at outlook dot com Target Milestone: --- The std::ilogb overloads for std::float16_t and std::bfloat16_t should return INT_MAX when given an infinite argument, but they don't. The second assertion in the C++23 program below shows this: #include <stdfloat> #include <cmath> #include <climits> #include <cassert> // g++ -std=c++23 gcc-ilogb.cpp int main(int argc, char*argv[]) { auto inf = std::numeric_limits<float>::infinity(); auto inf16 = std::numeric_limits<std::float16_t>::infinity(); auto infb16 = std::numeric_limits<std::bfloat16_t>::infinity(); assert(INT_MAX == std::ilogb(inf)); // correct assert(INT_MAX == std::ilogb(inf16) || INT_MAX == std::ilogb(infb16)); return 0; }