public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug math/4997] New: lround(nexafter(0.5,-1)) has incorrect value
@ 2007-09-06 17:38 fxcoudert at gcc dot gnu dot org
  2007-09-14 12:36 ` [Bug math/4997] " fxcoudert at gcc dot gnu dot org
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-09-06 17:38 UTC (permalink / raw)
  To: glibc-bugs

On powerpc-unknown-linux-gnu, with GNU C Library development release version 2.4
(20060617), lround(nextafter(0.5,-1)) returns 1 instead of the expected 0.


PS: it appears that powerpc glibc-2.6 is calculating lround(x) by converting
(x+0.5) into an integer (thanks to David Edelsohn for pointing that to me):

    fcmpu   cr6,fp1,fp12    /* if (x > 0.0)  */
    ble-    cr6,.L4
    fadd    fp1,fp1,fp10    /* x+= 0.5;  */
    fctiwz  fp2,fp1         /* Convert To Integer DW lround toward 0.  */
.L4:
    fsub    fp1,fp1,fp10    /* x-= 0.5;  */

I think 0.5 needs to be changed into nextafter(0.5,-1). Details of why can be
found here: http://gcc.gnu.org/ml/fortran/2005-04/msg00139.html

-- 
           Summary: lround(nexafter(0.5,-1)) has incorrect value
           Product: glibc
           Version: 2.4
            Status: NEW
          Severity: normal
          Priority: P2
         Component: math
        AssignedTo: aj at suse dot de
        ReportedBy: fxcoudert at gcc dot gnu dot org
                CC: glibc-bugs at sources dot redhat dot com
 GCC build triplet: powerpc-unknown-linux-gnu
  GCC host triplet: powerpc-unknown-linux-gnu
GCC target triplet: powerpc-unknown-linux-gnu


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

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

end of thread, other threads:[~2008-04-11 19:34 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-06 17:38 [Bug math/4997] New: lround(nexafter(0.5,-1)) has incorrect value fxcoudert at gcc dot gnu dot org
2007-09-14 12:36 ` [Bug math/4997] " fxcoudert at gcc dot gnu dot org
2007-09-14 13:54 ` fxcoudert at gcc dot gnu dot org
2007-10-22 22:52 ` rsa at us dot ibm dot com
2007-11-01 22:14 ` rsa at us dot ibm dot com
2007-11-08 18:53 ` rsa at us dot ibm dot com
2007-11-08 18:55 ` fxcoudert at gcc dot gnu dot org
2007-11-09 13:45 ` rsa at us dot ibm dot com
2007-11-09 19:41 ` rsa at us dot ibm dot com
2007-11-09 22:30 ` rsa at us dot ibm dot com
2007-11-20 21:46 ` rsa at us dot ibm dot com
2007-11-20 21:50 ` rsa at us dot ibm dot com
2007-11-29 16:01 ` rsa at us dot ibm dot com
2007-11-29 21:00 ` rsa at us dot ibm dot com
2008-04-10  5:51 ` drepper at redhat dot com
2008-04-11 15:56 ` rsa at us dot ibm dot com
2008-04-11 19:34 ` drepper 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).