Description of problem: Function double logb(double x) in math.h produces incorrect results when |x| < 1.0 -- specifically, it seems to produce 2^32 - exp(x). Version-Release number of selected component (if applicable): How reproducible: #include <math.h> #include <stdio.h> double ref_logb (double x) { return logb (x); } int main () { printf ("%lf\n", logb (0.5)); printf ("%lf\n", ref_logb (0.5)); return 0; } Steps to Reproduce: 1. Compile the above program with gcc (in my case gcc-4.6.3) 2. Run 3. Actual results: -1.0000000000000000e+00 4.2949672950000000e+09 Expected results: -1.0000000000000000e+00 -1.0000000000000000e+00 Additional info: The discrepancy seems to occur because the compiler optimizes out logb(0.5), but not the call to ref_logb()
This is fixed in rawhide, tested with glibc-2.15.90-3.fc18.x86_64. mock -r fedora-rawhide-x86_64 shell INFO: mock.py version 1.1.22 starting... State Changed: init plugins INFO: selinux enabled State Changed: start State Changed: lock buildroot State Changed: shell <mock-chroot>[root@stumpy /]# rpm -qa | grep glibc glibc-common-2.15.90-3.fc18.x86_64 glibc-headers-2.15.90-3.fc18.x86_64 glibc-2.15.90-3.fc18.x86_64 glibc-devel-2.15.90-3.fc18.x86_64 <mock-chroot>[root@stumpy /]# cat > foo.c #include <math.h> #include <stdio.h> double ref_logb (double x) { return logb (x); } int main () { printf ("%lf\n", logb (0.5)); printf ("%lf\n", ref_logb (0.5)); return 0; } <mock-chroot>[root@stumpy /]# gcc foo.c -lm <mock-chroot>[root@stumpy /]# ./a.out -1.000000 -1.000000 <mock-chroot>[root@stumpy /]#