summaryrefslogtreecommitdiff
path: root/src/floatfns.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/floatfns.c')
-rw-r--r--src/floatfns.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/floatfns.c b/src/floatfns.c
index 3f512ff3ccc..30336a6bc9b 100644
--- a/src/floatfns.c
+++ b/src/floatfns.c
@@ -454,7 +454,7 @@ DEFUN ("expt", Fexpt, Sexpt, 2, 2, 0,
(arg1, arg2)
register Lisp_Object arg1, arg2;
{
- double f1, f2;
+ double f1, f2, f3;
CHECK_NUMBER_OR_FLOAT (arg1);
CHECK_NUMBER_OR_FLOAT (arg2);
@@ -500,8 +500,11 @@ DEFUN ("expt", Fexpt, Sexpt, 2, 2, 0,
else if ((f1 == 0.0 && f2 < 0.0) || (f1 < 0 && f2 != floor(f2)))
domain_error2 ("expt", arg1, arg2);
#endif
- IN_FLOAT2 (f1 = pow (f1, f2), "expt", arg1, arg2);
- return make_float (f1);
+ IN_FLOAT2 (f3 = pow (f1, f2), "expt", arg1, arg2);
+ /* Check for overflow in the result. */
+ if (f1 != 0.0 && f3 == 0.0)
+ range_error ("expt", arg1);
+ return make_float (f3);
}
DEFUN ("log", Flog, Slog, 1, 2, 0,