Created attachment 6325 [details] test case Seen on glibc 2.11 Linux/PowerPC, on glibc 2.7 Linux/SPARC, on glibc 2.7 Linux/HP-PA. The function logbf() produces a wrong result for subnormal (denormalized) arguments. POSIX:2008 specifies the behaviour of this function for subnormal numbers: <http://pubs.opengroup.org/onlinepubs/9699919799/>. In particular, if x = 2^i is > 0, logb(x) must be = i. But in glibc on the specified platforms, for i < FLT_MIN_EXP-1, logbf(x) is too large. How to reproduce: ================================== foo.c ================================== #include <float.h> #include <math.h> volatile float x; int main () { int i; for (i = 0, x = 1.0f; i >= FLT_MIN_EXP - 1; i--, x *= 0.5f) ; /* Here i = FLT_MIN_EXP - 2. Either x = 2^i is subnormal or x = 0.0. */ if (x > 0.0f && !(logbf (x) == (float)i)) return 1; return 0; } =========================================================================== $ gcc foo.c -Wall -lm $ ./a.out; echo $? Expected result: 0 Actual result: 1
Fix commited to master (89c9aa491a7cee97bf78a29cddbf0a25c902a671).
I presume you intended to close this as fixed....