diff --git a/newlib/libm/common/s_nextafter.c b/newlib/libm/common/s_nextafter.c index 9453a0a00..356c79f3d 100644 --- a/newlib/libm/common/s_nextafter.c +++ b/newlib/libm/common/s_nextafter.c @@ -70,7 +70,7 @@ PORTABILITY 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 --git a/newlib/libm/common/sf_nextafter.c b/newlib/libm/common/sf_nextafter.c index cea4da58d..cdc7c663d 100644 --- a/newlib/libm/common/sf_nextafter.c +++ b/newlib/libm/common/sf_nextafter.c @@ -32,7 +32,7 @@ if(FLT_UWORD_IS_NAN(ix) || FLT_UWORD_IS_NAN(iy)) return x+y; - if(x==y) return x; /* x=y, return x */ + if(x==y) return y; /* x=y, return y */ if(FLT_UWORD_IS_ZERO(ix)) { /* x == 0 */ SET_FLOAT_WORD(x,(hy&0x80000000)|FLT_UWORD_MIN); y = x*x;