Bug 43355 - coshl(x) fails when x >= 711
coshl(x) fails when x >= 711
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: libc (Show other bugs)
7.1
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-06-03 15:16 EDT by Trevin Beattie
Modified: 2008-05-01 11:38 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-06-05 04:03:23 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Trevin Beattie 2001-06-03 15:16:20 EDT
From Bugzilla Helper:
User-Agent: Mozilla/4.77 [en] (X11; U; Linux 2.4.2-2 i586)

Description of problem:
The result of coshl(x) (defined as (e^x - e^-x)/2) should be representable
for all x where |x| <= 11357, but it overflows to infinity when |X| >= 711.


How reproducible:
Always

Steps to Reproduce:
Compile and run the following program:

#include <stdio.h>
#include <math.h>

main ()
{
  long double a, b;
  const long double test_cases[] = { 711.0L, 11356.0L };
  int i, r = 0;

  for (i = 0; i < sizeof (test_cases) / sizeof (test_cases[0]); i++) {
    a = coshl (test_cases[i]);
    b = (expl (test_cases[i]) - expl (-test_cases[i])) / 2.0L;
    if (a == b) {
      printf ("cosh(%Lg) = %Lg\n", a);
    } else {
      printf ("coshl(%Lg) returned %Lg; expected %Lg\n",
	      test_cases[i], a, b);
      r = 1;
    }
  }
  return r;
}


Actual Results:  coshl(711) returned inf; expected 3.03631e+308
coshl(11356) returned inf; expected 3.52457e+4931


Expected Results:  cosh(711) = 3.03631e+308
cosh(11356) = 3.52457e+4931


Additional info:

The source of this bug can be found in
glibc-2.2.3/sysdeps/generic/w_coshl.c.  When it checks for a range error,
it is using the domain limit of the double function
(710.475860073943863426) rather than the long double version
(11357.2165534747038948012940999836L).
Comment 1 Jakub Jelinek 2001-06-03 15:24:17 EDT
Then there should be special sysdeps/ieee754/ldbl-{96,128}/w_coshl.c,
I'll compute the constants tomorrow.
Comment 3 Jakub Jelinek 2001-06-07 09:19:51 EDT
Included in glibc-2.2.3-11.

Note You need to log in before you can comment on or make changes to this bug.