Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 43355 - coshl(x) fails when x >= 711
coshl(x) fails when x >= 711
Product: Red Hat Linux
Classification: Retired
Component: libc (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Depends On:
  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:
Last Closed: 2001-06-05 04:03:23 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2001:121 normal SHIPPED_LIVE GNU C Library bugfix update 2001-10-04 00:00:00 EDT

  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:

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
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.