This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug math/16740] New: IBM long double frexpl wrong when value slightly smaller than a power of two


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

            Bug ID: 16740
           Summary: IBM long double frexpl wrong when value slightly
                    smaller than a power of two
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: math
          Assignee: unassigned at sourceware dot org
          Reporter: amodra at gmail dot com

The following testcase passes a value slightly smaller than 1.0 to frexpl,
which ought to be returned unchanged with expon set to zero.  Instead we get a
value slightly smaller than 0.5 with expon set to one.

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

int main(void)
{
  union { long double ld; double d[2]; int i[4]; long long l[2]; } x;
  int expon;

  x.d[0] = 0x1p0;
  x.d[1] = -0x1p-106;
  printf ("%La %13a %13a 0x%16llx 0x%16llx\n",
          x.ld, x.d[0], x.d[1], x.l[0], x.l[1]);
  x.ld = frexpl (x.ld, &expon);
  printf ("%La %13a %13a 0x%16llx 0x%16llx\n",
          x.ld, x.d[0], x.d[1], x.l[0], x.l[1]);
  printf ("expon = %d\n", expon);
  return 0;
}

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]