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/5350] New: floor() is giving incorrect results on alpha


floor() is giving wrong result for some corner cases on alpha, as shown by the 
following testcase:

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

int main() {
  double x;

  printf("%s%d\n", "DBL_MANT_DIG = ", DBL_MANT_DIG);
  x = ldexp (1.0, DBL_MANT_DIG) - 1.0;
  printf("%lf %lf\n", x, floor(x));
  assert(x == floor(x));    /* does not work in alpha */
  return 0;
}

It is actually a regression introduced by the following changesets:

2007-03-14  Richard Henderson  <rth@redhat.com>

        * sysdeps/alpha/fpu/s_ceil.c: Rewrite without branches.
        * sysdeps/alpha/fpu/s_ceilf.c: Likewise.
        * sysdeps/alpha/fpu/s_floor.c: Likewise.
        * sysdeps/alpha/fpu/s_floorf.c: Likewise.
        * sysdeps/alpha/fpu/s_rint.c: Likewise.
        * sysdeps/alpha/fpu/s_rintf.c: Likewise.

This change also assumes that the internal FPU representation has the same 
precision as the IEEE one, which is not always true.

-- 
           Summary: floor() is giving incorrect results on alpha
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: math
        AssignedTo: aj at suse dot de
        ReportedBy: aurelien at aurel32 dot net
                CC: glibc-bugs at sources dot redhat dot com
 GCC build triplet: alphaev68-unknown-linux-gnu
  GCC host triplet: alphaev68-unknown-linux-gnu
GCC target triplet: alphaev68-unknown-linux-gnu


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

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


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