NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lib/44875: Return y in nextafter.c and nextafterf.c



>Number:         44875
>Category:       lib
>Synopsis:       Return y in nextafter.c and nextafterf.c
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Apr 18 08:55:00 +0000 2011
>Originator:     Henning Petersen
>Release:        NetBSD-current
>Organization:
>Environment:
>Description:
Man page is saying, that if (x == y) return is y;
>How-To-Repeat:

>Fix:
diff -u -r1.11 s_nextafter.c
--- lib/libm/src/s_nextafter.c  26 May 2002 22:01:57 -0000      1.11
+++ lib/libm/src/s_nextafter.c  17 Apr 2011 03:51:13 -0000
@@ -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;

diff -u -r1.7 s_nextafterf.c
--- lib/libm/src/s_nextafterf.c 26 May 2002 22:01:58 -0000      1.7
+++ lib/libm/src/s_nextafterf.c 17 Apr 2011 03:51:13 -0000
@@ -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;



Home | Main Index | Thread Index | Old Index