public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug math/16739] New: IBM long double nextafterl wrong on power of two value
@ 2014-03-22  9:40 amodra at gmail dot com
  2014-03-22  9:41 ` [Bug math/16739] " amodra at gmail dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: amodra at gmail dot com @ 2014-03-22  9:40 UTC (permalink / raw)
  To: glibc-bugs

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

            Bug ID: 16739
           Summary: IBM long double nextafterl wrong on power of two value
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: math
          Assignee: unassigned at sourceware dot org
          Reporter: amodra at gmail dot com

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

int main(void)
{
  union { long double ld; double d[2]; int i[4]; long long l[2]; } x;
  long double a = 1.0L;
  long double b = nextafterl (a, -2.0L);
  x.ld = b;
  printf ("%La %13a %13a 0x%16llx 0x%16llx\n",
          x.ld, x.d[0], x.d[1], x.l[0], x.l[1]);
  return 0;
}

results in
0x1.ffffffffffffffffffffffffffp-1        0x1p+0     -0x1p-105
0x3ff0000000000000 0xb960000000000000

This value is only 105 bits of precision.  It should be 0x1p0 - 0x1p-106.
The same thing will occur on any nextafterl call when the value is an exact
power of two, and the direction is to a smaller magnitude.

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


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

end of thread, other threads:[~2015-02-23 14:23 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-22  9:40 [Bug math/16739] New: IBM long double nextafterl wrong on power of two value amodra at gmail dot com
2014-03-22  9:41 ` [Bug math/16739] " amodra at gmail dot com
2014-03-25  2:32 ` amodra at gmail dot com
2014-04-02  3:18 ` cvs-commit at gcc dot gnu.org
2014-04-02  3:29 ` amodra at gmail dot com
2014-04-02 12:26 ` cvs-commit at gcc dot gnu.org
2014-06-12 19:56 ` fweimer at redhat dot com
2015-01-16 17:03 ` cvs-commit at gcc dot gnu.org
2015-02-23 14:23 ` cvs-commit at gcc dot gnu.org

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