X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fmath%2Fnextafter.c;h=5e53654a9bcc687e386523909a9ed554b1557871;hb=5298ab468eb88cace2413703ac409009efaa8ca7;hp=00209d299beb9a088cfb4e6f879db1e169d4cb72;hpb=781e3284dddd0d9cc713603f4bd05442df78e09a;p=libm diff --git a/src/math/nextafter.c b/src/math/nextafter.c index 00209d2..5e53654 100644 --- a/src/math/nextafter.c +++ b/src/math/nextafter.c @@ -45,22 +45,22 @@ double nextafter(double x, double y) if (hx >= 0) { /* x > 0 */ if (hx > hy || (hx == hy && lx > ly)) { /* x > y, x -= ulp */ if (lx == 0) - hx -= 1; - lx -= 1; + hx--; + lx--; } else { /* x < y, x += ulp */ - lx += 1; + lx++; if (lx == 0) - hx += 1; + hx++; } } else { /* x < 0 */ if (hy >= 0 || hx > hy || (hx == hy && lx > ly)) { /* x < y, x -= ulp */ if (lx == 0) - hx -= 1; - lx -= 1; + hx--; + lx--; } else { /* x > y, x += ulp */ - lx += 1; + lx++; if (lx == 0) - hx += 1; + hx++; } } hy = hx & 0x7ff00000;