Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libm/src according to C99/POSIX, nextafter(x, y) should r...



details:   https://anonhg.NetBSD.org/src/rev/e684b16ba4b9
branches:  trunk
changeset: 764385:e684b16ba4b9
user:      drochner <drochner%NetBSD.org@localhost>
date:      Mon Apr 18 15:59:09 2011 +0000

description:
according to C99/POSIX, nextafter(x,y) should return y if x==y, from
Henning Petersen per PR lib/44875

diffstat:

 lib/libm/src/s_nextafter.c  |  4 ++--
 lib/libm/src/s_nextafterf.c |  4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diffs (42 lines):

diff -r a8fb7e531fb6 -r e684b16ba4b9 lib/libm/src/s_nextafter.c
--- a/lib/libm/src/s_nextafter.c        Mon Apr 18 15:53:04 2011 +0000
+++ b/lib/libm/src/s_nextafter.c        Mon Apr 18 15:59:09 2011 +0000
@@ -12,7 +12,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBM_SCCS) && !defined(lint)
-__RCSID("$NetBSD: s_nextafter.c,v 1.11 2002/05/26 22:01:57 wiz Exp $");
+__RCSID("$NetBSD: s_nextafter.c,v 1.12 2011/04/18 15:59:09 drochner Exp $");
 #endif
 
 /* IEEE functions
@@ -39,7 +39,7 @@
        if(((ix>=0x7ff00000)&&((ix-0x7ff00000)|lx)!=0) ||   /* x is nan */
           ((iy>=0x7ff00000)&&((iy-0x7ff00000)|ly)!=0))     /* y is nan */
           return x+y;
-       if(x==y) return x;              /* x=y, return x */
+       if(x==y) return y;              /* x=y, return y */
        if((ix|lx)==0) {                        /* x == 0 */
            INSERT_WORDS(x,hy&0x80000000,1);    /* return +-minsubnormal */
            y = x*x;
diff -r a8fb7e531fb6 -r e684b16ba4b9 lib/libm/src/s_nextafterf.c
--- a/lib/libm/src/s_nextafterf.c       Mon Apr 18 15:53:04 2011 +0000
+++ b/lib/libm/src/s_nextafterf.c       Mon Apr 18 15:59:09 2011 +0000
@@ -15,7 +15,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBM_SCCS) && !defined(lint)
-__RCSID("$NetBSD: s_nextafterf.c,v 1.7 2002/05/26 22:01:58 wiz Exp $");
+__RCSID("$NetBSD: s_nextafterf.c,v 1.8 2011/04/18 15:59:09 drochner Exp $");
 #endif
 
 #include "math.h"
@@ -34,7 +34,7 @@
        if((ix>0x7f800000) ||   /* x is nan */
           (iy>0x7f800000))     /* y is nan */
           return x+y;
-       if(x==y) return x;              /* x=y, return x */
+       if(x==y) return y;              /* x=y, return y */
        if(ix==0) {                             /* x == 0 */
            SET_FLOAT_WORD(x,(hy&0x80000000)|1);/* return +-minsubnormal */
            y = x*x;



Home | Main Index | Thread Index | Old Index