Bug 838191
| Summary: | Function logb() in math.h produces incorrect results for small inputs | ||
|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Andre Kessler <akessler> |
| Component: | glibc | Assignee: | Jeff Law <law> |
| Status: | CLOSED RAWHIDE | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
| Severity: | urgent | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 16 | CC: | fweimer, jakub, law, pfrankli, schwab |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2012-07-10 16:01:22 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
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 /]#
|
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()