public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug math/5350] New: floor() is giving incorrect results on alpha
@ 2007-11-16 22:01 aurelien at aurel32 dot net
  2007-11-16 22:03 ` [Bug math/5350] " aurelien at aurel32 dot net
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: aurelien at aurel32 dot net @ 2007-11-16 22:01 UTC (permalink / raw)
  To: glibc-bugs

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.


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

* [Bug math/5350] floor() is giving incorrect results on alpha
  2007-11-16 22:01 [Bug math/5350] New: floor() is giving incorrect results on alpha aurelien at aurel32 dot net
@ 2007-11-16 22:03 ` aurelien at aurel32 dot net
  2008-03-09 12:33 ` aj at suse dot de
  2010-05-04 16:23 ` rth at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: aurelien at aurel32 dot net @ 2007-11-16 22:03 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From aurelien at aurel32 dot net  2007-11-16 22:02 -------
Created an attachment (id=2094)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=2094&action=view)
Patch to revert the code to the old version


-- 


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.


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

* [Bug math/5350] floor() is giving incorrect results on alpha
  2007-11-16 22:01 [Bug math/5350] New: floor() is giving incorrect results on alpha aurelien at aurel32 dot net
  2007-11-16 22:03 ` [Bug math/5350] " aurelien at aurel32 dot net
@ 2008-03-09 12:33 ` aj at suse dot de
  2010-05-04 16:23 ` rth at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: aj at suse dot de @ 2008-03-09 12:33 UTC (permalink / raw)
  To: glibc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|aj at suse dot de           |rth at redhat dot com
             Status|NEW                         |ASSIGNED


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.


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

* [Bug math/5350] floor() is giving incorrect results on alpha
  2007-11-16 22:01 [Bug math/5350] New: floor() is giving incorrect results on alpha aurelien at aurel32 dot net
  2007-11-16 22:03 ` [Bug math/5350] " aurelien at aurel32 dot net
  2008-03-09 12:33 ` aj at suse dot de
@ 2010-05-04 16:23 ` rth at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: rth at gcc dot gnu dot org @ 2010-05-04 16:23 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From rth at gcc dot gnu dot org  2010-05-04 16:23 -------
Patch applied: 116ff9ad1801108d084fd9ff94241f26a33dff1c

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


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.


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

end of thread, other threads:[~2010-05-04 16:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-16 22:01 [Bug math/5350] New: floor() is giving incorrect results on alpha aurelien at aurel32 dot net
2007-11-16 22:03 ` [Bug math/5350] " aurelien at aurel32 dot net
2008-03-09 12:33 ` aj at suse dot de
2010-05-04 16:23 ` rth at gcc dot gnu dot 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).