OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-dev/] [fsf-gcc-snapshot-1-mar-12/] [or1k-gcc/] [libquadmath/] [math/] [nextafterq.c] - Diff between revs 740 and 783

Only display areas with differences | Details | Blame | View Log

Rev 740 Rev 783
/* s_nextafterl.c -- long double version of s_nextafter.c.
/* s_nextafterl.c -- long double version of s_nextafter.c.
 * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz.
 * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz.
 */
 */
 
 
/*
/*
 * ====================================================
 * ====================================================
 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
 *
 *
 * Developed at SunPro, a Sun Microsystems, Inc. business.
 * Developed at SunPro, a Sun Microsystems, Inc. business.
 * Permission to use, copy, modify, and distribute this
 * Permission to use, copy, modify, and distribute this
 * software is freely granted, provided that this notice
 * software is freely granted, provided that this notice
 * is preserved.
 * is preserved.
 * ====================================================
 * ====================================================
 */
 */
 
 
#include "quadmath-imp.h"
#include "quadmath-imp.h"
 
 
__float128
__float128
nextafterq (__float128 x, __float128 y)
nextafterq (__float128 x, __float128 y)
{
{
        int64_t hx,hy,ix,iy;
        int64_t hx,hy,ix,iy;
        uint64_t lx,ly;
        uint64_t lx,ly;
 
 
        GET_FLT128_WORDS64(hx,lx,x);
        GET_FLT128_WORDS64(hx,lx,x);
        GET_FLT128_WORDS64(hy,ly,y);
        GET_FLT128_WORDS64(hy,ly,y);
        ix = hx&0x7fffffffffffffffLL;           /* |x| */
        ix = hx&0x7fffffffffffffffLL;           /* |x| */
        iy = hy&0x7fffffffffffffffLL;           /* |y| */
        iy = hy&0x7fffffffffffffffLL;           /* |y| */
 
 
        if(((ix>=0x7fff000000000000LL)&&((ix-0x7fff000000000000LL)|lx)!=0) ||   /* x is nan */
        if(((ix>=0x7fff000000000000LL)&&((ix-0x7fff000000000000LL)|lx)!=0) ||   /* x is nan */
           ((iy>=0x7fff000000000000LL)&&((iy-0x7fff000000000000LL)|ly)!=0))     /* y is nan */
           ((iy>=0x7fff000000000000LL)&&((iy-0x7fff000000000000LL)|ly)!=0))     /* y is nan */
           return x+y;
           return x+y;
        if(x==y) return y;              /* x=y, return y */
        if(x==y) return y;              /* x=y, return y */
        if((ix|lx)==0) {                 /* x == 0 */
        if((ix|lx)==0) {                 /* x == 0 */
            SET_FLT128_WORDS64(x,hy&0x8000000000000000ULL,1);/* return +-minsubnormal */
            SET_FLT128_WORDS64(x,hy&0x8000000000000000ULL,1);/* return +-minsubnormal */
 
 
            /* here we should raise an underflow flag */
            /* here we should raise an underflow flag */
            return x;
            return x;
        }
        }
        if(hx>=0) {                      /* x > 0 */
        if(hx>=0) {                      /* x > 0 */
            if(hx>hy||((hx==hy)&&(lx>ly))) {    /* x > y, x -= ulp */
            if(hx>hy||((hx==hy)&&(lx>ly))) {    /* x > y, x -= ulp */
                if(lx==0) hx--;
                if(lx==0) hx--;
                lx--;
                lx--;
            } else {                            /* x < y, x += ulp */
            } else {                            /* x < y, x += ulp */
                lx++;
                lx++;
                if(lx==0) hx++;
                if(lx==0) hx++;
            }
            }
        } else {                                /* x < 0 */
        } else {                                /* x < 0 */
            if(hy>=0||hx>hy||((hx==hy)&&(lx>ly))){/* x < y, x -= ulp */
            if(hy>=0||hx>hy||((hx==hy)&&(lx>ly))){/* x < y, x -= ulp */
                if(lx==0) hx--;
                if(lx==0) hx--;
                lx--;
                lx--;
            } else {                            /* x > y, x += ulp */
            } else {                            /* x > y, x += ulp */
                lx++;
                lx++;
                if(lx==0) hx++;
                if(lx==0) hx++;
            }
            }
        }
        }
        hy = hx&0x7fff000000000000LL;
        hy = hx&0x7fff000000000000LL;
        if(hy==0x7fff000000000000LL) return x+x;/* overflow  */
        if(hy==0x7fff000000000000LL) return x+x;/* overflow  */
        if(hy==0) {
        if(hy==0) {
            /* here we should raise an underflow flag */
            /* here we should raise an underflow flag */
        }
        }
        SET_FLT128_WORDS64(x,hx,lx);
        SET_FLT128_WORDS64(x,hx,lx);
        return x;
        return x;
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.