according to C99/POSIX, nextafter(x,y) should return y if x==y, from

Henning Petersen per PR lib/44875
This commit is contained in:
drochner 2011-04-18 15:59:09 +00:00
parent 23e8e926b4
commit 1e1bb256ba
2 changed files with 4 additions and 4 deletions

View File

@ -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 @@ nextafter(double x, double y)
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;

View File

@ -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 @@ nextafterf(float x, float y)
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;