diff options
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/generic/glob.c | 32 | ||||
-rw-r--r-- | sysdeps/libm-ieee754/k_standard.c | 3 | ||||
-rw-r--r-- | sysdeps/libm-ieee754/w_gamma.c | 26 | ||||
-rw-r--r-- | sysdeps/libm-ieee754/w_gammaf.c | 32 | ||||
-rw-r--r-- | sysdeps/libm-ieee754/w_gammal.c | 26 |
5 files changed, 84 insertions, 35 deletions
diff --git a/sysdeps/generic/glob.c b/sysdeps/generic/glob.c index 9182c0585a..56bc0fbd53 100644 --- a/sysdeps/generic/glob.c +++ b/sysdeps/generic/glob.c @@ -693,7 +693,7 @@ glob (pattern, flags, errfunc, pglob) appending the results to PGLOB. */ for (i = 0; i < dirs.gl_pathc; ++i) { - int oldcount; + int old_pathc; #ifdef SHELL { @@ -709,7 +709,7 @@ glob (pattern, flags, errfunc, pglob) } #endif /* SHELL. */ - oldcount = pglob->gl_pathc; + old_pathc = pglob->gl_pathc; status = glob_in_dir (filename, dirs.gl_pathv[i], ((flags | GLOB_APPEND) & ~(GLOB_NOCHECK | GLOB_ERR)), @@ -727,8 +727,8 @@ glob (pattern, flags, errfunc, pglob) /* Stick the directory on the front of each name. */ if (prefix_array (dirs.gl_pathv[i], - &pglob->gl_pathv[oldcount], - pglob->gl_pathc - oldcount)) + &pglob->gl_pathv[old_pathc], + pglob->gl_pathc - old_pathc)) { globfree (&dirs); globfree (pglob); @@ -781,9 +781,14 @@ glob (pattern, flags, errfunc, pglob) if (dirlen > 0) { /* Stick the directory on the front of each name. */ + int ignore = oldcount; + + if ((flags & GLOB_DOOFFS) && ignore < pglob->gl_offs) + ignore = pglob->gl_offs; + if (prefix_array (dirname, - &pglob->gl_pathv[oldcount], - pglob->gl_pathc - oldcount)) + &pglob->gl_pathv[ignore], + pglob->gl_pathc - ignore)) { globfree (pglob); return GLOB_NOSPACE; @@ -815,10 +820,17 @@ glob (pattern, flags, errfunc, pglob) } if (!(flags & GLOB_NOSORT)) - /* Sort the vector. */ - qsort ((__ptr_t) &pglob->gl_pathv[oldcount], - pglob->gl_pathc - oldcount, - sizeof (char *), collated_compare); + { + /* Sort the vector. */ + int non_sort = oldcount; + + if ((flags & GLOB_DOOFFS) && pglob->gl_offs > oldcount) + non_sort = pglob->gl_offs; + + qsort ((__ptr_t) &pglob->gl_pathv[non_sort], + pglob->gl_pathc - non_sort, + sizeof (char *), collated_compare); + } return 0; } diff --git a/sysdeps/libm-ieee754/k_standard.c b/sysdeps/libm-ieee754/k_standard.c index aeaa50f2ee..82cfbe467a 100644 --- a/sysdeps/libm-ieee754/k_standard.c +++ b/sysdeps/libm-ieee754/k_standard.c @@ -845,12 +845,13 @@ static double zero = 0.0; /* used as const */ exc.type = SING; exc.name = type < 100 ? "gamma" : (type < 200 ? "gammaf" : "gammal"); - exc.retval = HUGE_VAL; + exc.retval = NAN; if (_LIB_VERSION == _POSIX_) __set_errno (EDOM); else if (!matherr(&exc)) { if (_LIB_VERSION == _SVID_) { (void) WRITE2("gamma: SING error\n", 18); + exc.retval = HUGE_VAL; } __set_errno (EDOM); } diff --git a/sysdeps/libm-ieee754/w_gamma.c b/sysdeps/libm-ieee754/w_gamma.c index 02a3d47669..3511b67d77 100644 --- a/sysdeps/libm-ieee754/w_gamma.c +++ b/sysdeps/libm-ieee754/w_gamma.c @@ -32,7 +32,18 @@ static char rcsid[] = "$NetBSD: w_gamma.c,v 1.7 1995/11/20 22:06:43 jtc Exp $"; double y; #ifndef _IEEE_LIBM if (_LIB_VERSION == _SVID_) - y = __ieee754_lgamma_r(x,&signgam); + { + y = __ieee754_lgamma_r(x,&signgam); + + if(!__finite(y)&&__finite(x)) { + if(__floor(x)==x&&x<=(double)0.0) + /* lgamma pole */ + return __kernel_standard(x,x,15); + else + /* lgamma overflow */ + return __kernel_standard(x,x,14); + } + } else { #endif @@ -43,14 +54,15 @@ static char rcsid[] = "$NetBSD: w_gamma.c,v 1.7 1995/11/20 22:06:43 jtc Exp $"; return y; #else if(_LIB_VERSION == _IEEE_) return y; - } - if(!__finite(y)&&__finite(x)) { - if(__floor(x)==x&&x<=0.0) + + if(!__finite(y)&&__finite(x)) { + if(__floor(x)==x&&x<=0.0) return __kernel_standard(x,x,41); /* gamma pole */ - else + else return __kernel_standard(x,x,40); /* gamma overflow */ - } else - return y; + } + } + return y; #endif } weak_alias (__gamma, gamma) diff --git a/sysdeps/libm-ieee754/w_gammaf.c b/sysdeps/libm-ieee754/w_gammaf.c index 7d78a52908..bc251b3554 100644 --- a/sysdeps/libm-ieee754/w_gammaf.c +++ b/sysdeps/libm-ieee754/w_gammaf.c @@ -30,7 +30,18 @@ static char rcsid[] = "$NetBSD: w_gammaf.c,v 1.4 1995/11/20 22:06:48 jtc Exp $"; float y; #ifndef _IEEE_LIBM if (_LIB_VERSION == _SVID_) - y = __ieee754_lgammaf_r(x,&signgam); + { + y = __ieee754_lgammaf_r(x,&signgam); + + if(!__finitef(y)&&__finitef(x)) { + if(__floorf(x)==x&&x<=(float)0.0) + /* lgammaf pole */ + return (float)__kernel_standard((double)x,(double)x,115); + else + /* lgammaf overflow */ + return (float)__kernel_standard((double)x,(double)x,114); + } + } else { #endif @@ -41,16 +52,17 @@ static char rcsid[] = "$NetBSD: w_gammaf.c,v 1.4 1995/11/20 22:06:48 jtc Exp $"; return y; #else if(_LIB_VERSION == _IEEE_) return y; + + if(!__finitef(y)&&__finitef(x)) { + if(__floorf(x)==x&&x<=(float)0.0) + /* gammaf pole */ + return (float)__kernel_standard((double)x,(double)x,141); + else + /* gammaf overflow */ + return (float)__kernel_standard((double)x,(double)x,140); + } } - if(!__finitef(y)&&__finitef(x)) { - if(__floorf(x)==x&&x<=(float)0.0) - /* gammaf pole */ - return (float)__kernel_standard((double)x,(double)x,141); - else - /* gammaf overflow */ - return (float)__kernel_standard((double)x,(double)x,140); - } else - return y; + return y; #endif } weak_alias (__gammaf, gammaf) diff --git a/sysdeps/libm-ieee754/w_gammal.c b/sysdeps/libm-ieee754/w_gammal.c index 1b4ae2cc7b..68328f652a 100644 --- a/sysdeps/libm-ieee754/w_gammal.c +++ b/sysdeps/libm-ieee754/w_gammal.c @@ -35,7 +35,18 @@ static char rcsid[] = "$NetBSD: $"; long double y; #ifndef _IEEE_LIBM if (_LIB_VERSION == _SVID_) - y = __ieee754_lgammal_r(x,&signgam); + { + y = __ieee754_lgammal_r(x,&signgam); + + if(!__finitel(y)&&__finitel(x)) { + if(__floorl(x)==x&&x<=(long double)0.0) + /* lgamma pole */ + return (long double)__kernel_standard((double)x,(double)x,15); + else + /* lgamma overflow */ + return (long double)__kernel_standard((double)x,(double)x,14); + } + } else { #endif @@ -46,14 +57,15 @@ static char rcsid[] = "$NetBSD: $"; return y; #else if(_LIB_VERSION == _IEEE_) return y; - } - if(!__finitel(y)&&__finitel(x)) { - if(__floorl(x)==x&&x<=0.0) + + if(!__finitel(y)&&__finitel(x)) { + if(__floorl(x)==x&&x<=0.0) return __kernel_standard(x,x,241); /* gamma pole */ - else + else return __kernel_standard(x,x,240); /* gamma overflow */ - } else - return y; + } + } + return y; #endif } weak_alias (__gammal, gammal) |