public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug math/13956] New: logbl() produces wrong results for subnormal 'long double' numbers
@ 2012-04-06 14:23 bruno at clisp dot org
  2012-04-06 14:57 ` [Bug math/13956] " bruno at clisp dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: bruno at clisp dot org @ 2012-04-06 14:23 UTC (permalink / raw)
  To: glibc-bugs

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

             Bug #: 13956
           Summary: logbl() produces wrong results for subnormal 'long
                    double' numbers
           Product: glibc
           Version: 2.11
            Status: NEW
          Severity: normal
          Priority: P2
         Component: math
        AssignedTo: unassigned@sourceware.org
        ReportedBy: bruno@clisp.org
    Classification: Unclassified


Created attachment 6326
  --> http://sourceware.org/bugzilla/attachment.cgi?id=6326
test case

Seen on glibc 2.11 Linux/PowerPC,
on glibc 2.7 Linux/SPARC,
on glibc 2.7 Linux/HP-PA.

The function logbl() produces a wrong result for subnormal (denormalized)
arguments.

POSIX:2008 specifies the behaviour of this function for subnormal numbers:
<http://pubs.opengroup.org/onlinepubs/9699919799/>.
In particular, if x = 2^i is > 0, logb(x) must be = i.

But in glibc on the specified platforms, for some values of i < LDBL_MIN_EXP-1,
logb(x) is too large.

How to reproduce:
================================== foo.c ==================================
#include <float.h>
#include <math.h>
volatile long double x;
int main ()
{
  int i;
  for (i = 0, x = 1.0L; i >= LDBL_MIN_EXP - 55; i--, x *= 0.5L)
    /* Either x = 2^i or x = 0.0.  */
    if ((i == LDBL_MIN_EXP - 2 || i == LDBL_MIN_EXP - 55)
        && (x > 0.0L && !(logbl (x) == (long double)i)))
      return 1;
  return 0;
}
===========================================================================
$ gcc foo.c -Wall -lm
$ ./a.out; echo $?

Expected result:
0

Actual result:
1

-- 
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] 5+ messages in thread

* [Bug math/13956] logbl() produces wrong results for subnormal 'long double' numbers
  2012-04-06 14:23 [Bug math/13956] New: logbl() produces wrong results for subnormal 'long double' numbers bruno at clisp dot org
@ 2012-04-06 14:57 ` bruno at clisp dot org
  2012-05-10 23:47 ` azanella at linux dot vnet.ibm.com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: bruno at clisp dot org @ 2012-04-06 14:57 UTC (permalink / raw)
  To: glibc-bugs

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

Bruno Haible <bruno at clisp dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |http://sourceware.org/bugzi
                   |                            |lla/show_bug.cgi?id=13954,
                   |                            |http://sourceware.org/bugzi
                   |                            |lla/show_bug.cgi?id=13955

-- 
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] 5+ messages in thread

* [Bug math/13956] logbl() produces wrong results for subnormal 'long double' numbers
  2012-04-06 14:23 [Bug math/13956] New: logbl() produces wrong results for subnormal 'long double' numbers bruno at clisp dot org
  2012-04-06 14:57 ` [Bug math/13956] " bruno at clisp dot org
@ 2012-05-10 23:47 ` azanella at linux dot vnet.ibm.com
  2012-05-11  9:26 ` jsm28 at gcc dot gnu.org
  2014-06-25 11:20 ` fweimer at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: azanella at linux dot vnet.ibm.com @ 2012-05-10 23:47 UTC (permalink / raw)
  To: glibc-bugs

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

Adhemerval Zanella Netto <azanella at linux dot vnet.ibm.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |azanella at linux dot
                   |                            |vnet.ibm.com

--- Comment #1 from Adhemerval Zanella Netto <azanella at linux dot vnet.ibm.com> 2012-05-10 23:47:04 UTC ---
Fix commited to master (89c9aa491a7cee97bf78a29cddbf0a25c902a671).

-- 
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] 5+ messages in thread

* [Bug math/13956] logbl() produces wrong results for subnormal 'long double' numbers
  2012-04-06 14:23 [Bug math/13956] New: logbl() produces wrong results for subnormal 'long double' numbers bruno at clisp dot org
  2012-04-06 14:57 ` [Bug math/13956] " bruno at clisp dot org
  2012-05-10 23:47 ` azanella at linux dot vnet.ibm.com
@ 2012-05-11  9:26 ` jsm28 at gcc dot gnu.org
  2014-06-25 11:20 ` fweimer at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2012-05-11  9:26 UTC (permalink / raw)
  To: glibc-bugs

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

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

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

--- Comment #2 from Joseph Myers <jsm28 at gcc dot gnu.org> 2012-05-11 09:25:46 UTC ---
I presume you intended to close this as fixed....

-- 
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] 5+ messages in thread

* [Bug math/13956] logbl() produces wrong results for subnormal 'long double' numbers
  2012-04-06 14:23 [Bug math/13956] New: logbl() produces wrong results for subnormal 'long double' numbers bruno at clisp dot org
                   ` (2 preceding siblings ...)
  2012-05-11  9:26 ` jsm28 at gcc dot gnu.org
@ 2014-06-25 11:20 ` fweimer at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: fweimer at redhat dot com @ 2014-06-25 11:20 UTC (permalink / raw)
  To: glibc-bugs

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

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] 5+ messages in thread

end of thread, other threads:[~2014-06-25 11:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-06 14:23 [Bug math/13956] New: logbl() produces wrong results for subnormal 'long double' numbers bruno at clisp dot org
2012-04-06 14:57 ` [Bug math/13956] " bruno at clisp dot org
2012-05-10 23:47 ` azanella at linux dot vnet.ibm.com
2012-05-11  9:26 ` jsm28 at gcc dot gnu.org
2014-06-25 11:20 ` 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).