Module Name:    src
Committed By:   drochner
Date:           Mon Apr 18 15:59:09 UTC 2011

Modified Files:
        src/lib/libm/src: s_nextafter.c s_nextafterf.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/lib/libm/src/s_nextafter.c
cvs rdiff -u -r1.7 -r1.8 src/lib/libm/src/s_nextafterf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libm/src/s_nextafter.c
diff -u src/lib/libm/src/s_nextafter.c:1.11 src/lib/libm/src/s_nextafter.c:1.12
--- src/lib/libm/src/s_nextafter.c:1.11	Sun May 26 22:01:57 2002
+++ src/lib/libm/src/s_nextafter.c	Mon Apr 18 15:59:09 2011
@@ -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;

Index: src/lib/libm/src/s_nextafterf.c
diff -u src/lib/libm/src/s_nextafterf.c:1.7 src/lib/libm/src/s_nextafterf.c:1.8
--- src/lib/libm/src/s_nextafterf.c:1.7	Sun May 26 22:01:58 2002
+++ src/lib/libm/src/s_nextafterf.c	Mon Apr 18 15:59:09 2011
@@ -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;

Reply via email to