public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug math/5794] New: expm1l(x) overflows when 11356.1768 < x <= 11356.5234
@ 2008-02-26  7:04 petrosyan at gmail dot com
  2008-02-26  7:09 ` [Bug math/5794] " petrosyan at gmail dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: petrosyan at gmail dot com @ 2008-02-26  7:04 UTC (permalink / raw)
  To: glibc-bugs

The value of (e^x - 1) is representable as a long double when x <=
11356.5234, but expm1l(x) overflows to infinity when x > 11356.1768
(approximately).

Steps to Reproduce:
Compile and run the following program:

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

main ()
{
  long double a, b;
  const long double x = 11356.35L;

  a = expl (x) - 1.0L;
  b = expm1l (x);
  if (a == b) {
    printf ("e^%.2Lf - 1 = %Lg\n", b);
    return 0;
  } else {
    printf ("e^%.2Lf - 1 = %Lg; but expm1l(%.2Lf) returned %Lg\n",
	    x, a, x, b);
    return 1;
  }
}


Actual Results:  e^11356.35 - 1 = 1.00032e+4932; but expm1l(11356.35)
returned inf


Expected Results:  e^11356.35 - 1 = 1.00032e+4932


Additional info:

This bug probably isn't even worth reporting, except for completeness. 
expm1l is designed to compute e^x-1 more accurately when x is negative, so
[at least the i386 version] uses a slightly different algorithm than expl. 
This algorithm overflows for large x where expl would not.  But then, expm1
really isn't intended for large x anyway.

In my own port of the math library, I circumvent the problem by calling
__ieee754_expl when x >= 64, because at that magnitude, -1 is too small to
affect the result.  This is probably overkill, but it works.

-- 
           Summary: expm1l(x) overflows when 11356.1768 < x <= 11356.5234
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: minor
          Priority: P2
         Component: math
        AssignedTo: aj at suse dot de
        ReportedBy: petrosyan at gmail dot com
                CC: glibc-bugs at sources dot redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=5794

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug math/5794] expm1l(x) overflows when 11356.1768 < x <= 11356.5234
  2008-02-26  7:04 [Bug math/5794] New: expm1l(x) overflows when 11356.1768 < x <= 11356.5234 petrosyan at gmail dot com
@ 2008-02-26  7:09 ` petrosyan at gmail dot com
  2008-02-26  7:09 ` petrosyan at gmail dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: petrosyan at gmail dot com @ 2008-02-26  7:09 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From petrosyan at gmail dot com  2008-02-26 07:08 -------
original bug filed at https://bugzilla.redhat.com/show_bug.cgi?id=43354

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|unspecified                 |2.2.5


http://sourceware.org/bugzilla/show_bug.cgi?id=5794

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug math/5794] expm1l(x) overflows when 11356.1768 < x <= 11356.5234
  2008-02-26  7:04 [Bug math/5794] New: expm1l(x) overflows when 11356.1768 < x <= 11356.5234 petrosyan at gmail dot com
  2008-02-26  7:09 ` [Bug math/5794] " petrosyan at gmail dot com
@ 2008-02-26  7:09 ` petrosyan at gmail dot com
  2008-07-30 10:08 ` vda dot linux at googlemail dot com
  2008-08-05 22:11 ` drepper at redhat dot com
  3 siblings, 0 replies; 7+ messages in thread
From: petrosyan at gmail dot com @ 2008-02-26  7:09 UTC (permalink / raw)
  To: glibc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|2.2.5                       |unspecified


http://sourceware.org/bugzilla/show_bug.cgi?id=5794

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug math/5794] expm1l(x) overflows when 11356.1768 < x <= 11356.5234
  2008-02-26  7:04 [Bug math/5794] New: expm1l(x) overflows when 11356.1768 < x <= 11356.5234 petrosyan at gmail dot com
  2008-02-26  7:09 ` [Bug math/5794] " petrosyan at gmail dot com
  2008-02-26  7:09 ` petrosyan at gmail dot com
@ 2008-07-30 10:08 ` vda dot linux at googlemail dot com
  2008-08-05 22:11 ` drepper at redhat dot com
  3 siblings, 0 replies; 7+ messages in thread
From: vda dot linux at googlemail dot com @ 2008-07-30 10:08 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From vda dot linux at googlemail dot com  2008-07-30 10:07 -------
I submitted a fix, see RH bugzilla:
https://bugzilla.redhat.com/show_bug.cgi?id=43354

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=5794

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug math/5794] expm1l(x) overflows when 11356.1768 < x <= 11356.5234
  2008-02-26  7:04 [Bug math/5794] New: expm1l(x) overflows when 11356.1768 < x <= 11356.5234 petrosyan at gmail dot com
                   ` (2 preceding siblings ...)
  2008-07-30 10:08 ` vda dot linux at googlemail dot com
@ 2008-08-05 22:11 ` drepper at redhat dot com
  3 siblings, 0 replies; 7+ messages in thread
From: drepper at redhat dot com @ 2008-08-05 22:11 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From drepper at redhat dot com  2008-08-05 22:09 -------
Fixed in cvs.

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=5794

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug math/5794] expm1l(x) overflows when 11356.1768 < x <= 11356.5234
       [not found] <bug-5794-131@http.sourceware.org/bugzilla/>
  2012-02-29 17:49 ` jsm28 at gcc dot gnu.org
@ 2014-07-02  7:02 ` fweimer at redhat dot com
  1 sibling, 0 replies; 7+ messages in thread
From: fweimer at redhat dot com @ 2014-07-02  7:02 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=5794

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
              Flags|                            |security-

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug math/5794] expm1l(x) overflows when 11356.1768 < x <= 11356.5234
       [not found] <bug-5794-131@http.sourceware.org/bugzilla/>
@ 2012-02-29 17:49 ` jsm28 at gcc dot gnu.org
  2014-07-02  7:02 ` fweimer at redhat dot com
  1 sibling, 0 replies; 7+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2012-02-29 17:49 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=5794

Joseph Myers <jsm28 at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #4 from Joseph Myers <jsm28 at gcc dot gnu.org> 2012-02-29 17:49:28 UTC ---
This was fixed by:

2008-08-05  Ulrich Drepper  <drepper@redhat.com>

        [BZ #5794]
        * sysdeps/i386/fpu/s_expm1l.S: Simply use exp implementation for large
        parameters.
        * sysdeps/x86_64/fpu/s_expm1l.S: Likewise.
        Patch by Denys Vlasenko <dvlasenk@redhat.com>.

A testcase wasn't added to the testsuite at the time.  I've now proposed adding
one: http://sourceware.org/ml/libc-alpha/2012-02/msg00773.html

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-07-02  7:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-26  7:04 [Bug math/5794] New: expm1l(x) overflows when 11356.1768 < x <= 11356.5234 petrosyan at gmail dot com
2008-02-26  7:09 ` [Bug math/5794] " petrosyan at gmail dot com
2008-02-26  7:09 ` petrosyan at gmail dot com
2008-07-30 10:08 ` vda dot linux at googlemail dot com
2008-08-05 22:11 ` drepper at redhat dot com
     [not found] <bug-5794-131@http.sourceware.org/bugzilla/>
2012-02-29 17:49 ` jsm28 at gcc dot gnu.org
2014-07-02  7:02 ` fweimer at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).