diff options
author | das <das@FreeBSD.org> | 2005-01-23 15:46:22 +0000 |
---|---|---|
committer | das <das@FreeBSD.org> | 2005-01-23 15:46:22 +0000 |
commit | e52e82773be5e182ecba0a89989d618d37462ca5 (patch) | |
tree | 32ab830b0bb52197641e7251209ffd42a3b9083e /lib | |
parent | 2231fe9f4db6d8ee45e83d7302fae92714216478 (diff) | |
download | FreeBSD-src-e52e82773be5e182ecba0a89989d618d37462ca5.zip FreeBSD-src-e52e82773be5e182ecba0a89989d618d37462ca5.tar.gz |
If x == y, return y, not x. C99 (though not IEEE 754) requires that
nextafter(+0.0, -0.0) returns -0.0 and nextafter(-0.0, +0.0) returns +0.0.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/msun/src/s_nextafter.c | 2 | ||||
-rw-r--r-- | lib/msun/src/s_nextafterf.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/msun/src/s_nextafter.c b/lib/msun/src/s_nextafter.c index f8f15fe..a5a883b 100644 --- a/lib/msun/src/s_nextafter.c +++ b/lib/msun/src/s_nextafter.c @@ -38,7 +38,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 x */ if((ix|lx)==0) { /* x == 0 */ INSERT_WORDS(x,hy&0x80000000,1); /* return +-minsubnormal */ y = x*x; diff --git a/lib/msun/src/s_nextafterf.c b/lib/msun/src/s_nextafterf.c index d7cf1ab..812da2a 100644 --- a/lib/msun/src/s_nextafterf.c +++ b/lib/msun/src/s_nextafterf.c @@ -33,7 +33,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 x */ if(ix==0) { /* x == 0 */ SET_FLOAT_WORD(x,(hy&0x80000000)|1);/* return +-minsubnormal */ y = x*x; |