This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug math/14273] New: cosh() returns incorrect results
- From: "pdemarco at maplesoft dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: Thu, 21 Jun 2012 13:25:13 +0000
- Subject: [Bug math/14273] New: cosh() returns incorrect results
- Auto-submitted: auto-generated
http://sourceware.org/bugzilla/show_bug.cgi?id=14273
Bug #: 14273
Summary: cosh() returns incorrect results
Product: glibc
Version: 2.15
Status: NEW
Severity: critical
Priority: P2
Component: math
AssignedTo: unassigned@sourceware.org
ReportedBy: pdemarco@maplesoft.com
Classification: Unclassified
cosh() returns incorrect results in the most recent version of libm.
Here is an example:
ubuntu64ma337>> cat test.c
#include <stdio.h>
#include <math.h>
int main(int argv, char *argc[])
{
double np = 709.889355812725967;
printf("%g\n", cosh(709.889355812725967) );
printf("%g\n", cosh(np) );
double nm = -709.889355812725967;
printf("%g\n", cosh(-709.889355812725967) );
printf("%g\n", cosh(nm) );
return 0;
}
ubuntu64ma337>> gcc test.c -lm
ubuntu64ma337>> a.out
1e+308
1e+308
1e+308
inf
The last result is wrong.
I believe this is because of the following change made to glibc 2.15:
* Integrate libm with gcc's -ffinite-math-only option.
Implemented by Ulrich Drepper.
Note that http://gcc.gnu.org/onlinedocs/gcc-3.3.6/g77/Optimize-Options.html has
this to say about the finite-math-only option:
-ffinite-math-only
Allow optimizations for floating-point arithmetic that assume that arguments
and results are not NaNs or +-Infs.
This option should never be turned on by any -O option since it can result in
incorrect output for programs which depend on an exact implementation of IEEE
or ISO rules/specifications.
The default is -fno-finite-math-only.
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.