diff options
Diffstat (limited to 'sysdeps/libm-ieee754/e_scalb.c')
-rw-r--r-- | sysdeps/libm-ieee754/e_scalb.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sysdeps/libm-ieee754/e_scalb.c b/sysdeps/libm-ieee754/e_scalb.c index 86d10bf683..d9a326b2b2 100644 --- a/sysdeps/libm-ieee754/e_scalb.c +++ b/sysdeps/libm-ieee754/e_scalb.c @@ -45,9 +45,13 @@ static char rcsid[] = "$NetBSD: e_scalb.c,v 1.6 1995/05/10 20:46:09 jtc Exp $"; if (__isnan(x)||__isnan(fn)) return x*fn; if (!__finite(fn)) { if(fn>0.0) return x*fn; + else if (x == 0) + return x; + else if (!__finite (x)) + return __nan (""); else return x/(-fn); } - if (__rint(fn)!=fn) return (fn-fn)/(fn-fn); + if (__rint(fn)!=fn) return __nan (""); if ( fn > 65000.0) return __scalbn(x, 65000); if (-fn > 65000.0) return __scalbn(x,-65000); return __scalbn(x,(int)fn); |