summary refs log tree commit diff
path: root/sysdeps/libm-ieee754/e_scalbl.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/libm-ieee754/e_scalbl.c')
-rw-r--r--sysdeps/libm-ieee754/e_scalbl.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sysdeps/libm-ieee754/e_scalbl.c b/sysdeps/libm-ieee754/e_scalbl.c
index 823eebda91..dccc876c85 100644
--- a/sysdeps/libm-ieee754/e_scalbl.c
+++ b/sysdeps/libm-ieee754/e_scalbl.c
@@ -49,9 +49,13 @@ static char rcsid[] = "$NetBSD: $";
 	if (__isnanl(x)||__isnanl(fn)) return x*fn;
 	if (!__finitel(fn)) {
 	    if(fn>0.0) return x*fn;
+	    else if (x == 0)
+	      return x;
+	    else if (!__finitel (x))
+	      return __nanl ("");
 	    else       return x/(-fn);
 	}
-	if (__rintl(fn)!=fn) return (fn-fn)/(fn-fn);
+	if (__rintl(fn)!=fn) return __nanl ("");
 	if ( fn > 65000.0) return __scalbnl(x, 65000);
 	if (-fn > 65000.0) return __scalbnl(x,-65000);
 	return __scalbnl(x,(int)fn);