aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichaël Cadilhac2007-10-01 09:17:29 +0000
committerMichaël Cadilhac2007-10-01 09:17:29 +0000
commit2742fe306859d828cbeff3ae0371e2217b09cd4c (patch)
tree69112996f8574c08ea9291d0083d84f2fc671bf5 /src
parent5db17239182556967bfaa5723214f31b8a91db6f (diff)
downloademacs-2742fe306859d828cbeff3ae0371e2217b09cd4c.tar.gz
emacs-2742fe306859d828cbeff3ae0371e2217b09cd4c.zip
(Fexpt): Manually check for overflows, so that a power
of a non-zero value can't yield zero.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/floatfns.c9
2 files changed, 11 insertions, 3 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 70fbaad280e..e71218880bc 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
12007-10-01 Micha,Ak(Bl Cadilhac <michael@cadilhac.name>
2
3 * floatfns.c (Fexpt): Manually check for overflows, so that a power
4 of a non-zero value can't yield zero.
5
12007-09-29 Stefan Monnier <monnier@iro.umontreal.ca> 62007-09-29 Stefan Monnier <monnier@iro.umontreal.ca>
2 7
3 * term.c (term_clear_mouse_face, term_mouse_highlight) 8 * term.c (term_clear_mouse_face, term_mouse_highlight)
diff --git a/src/floatfns.c b/src/floatfns.c
index 6ad9b95686e..a20f7981bf0 100644
--- a/src/floatfns.c
+++ b/src/floatfns.c
@@ -454,7 +454,7 @@ DEFUN ("expt", Fexpt, Sexpt, 2, 2, 0,
454 (arg1, arg2) 454 (arg1, arg2)
455 register Lisp_Object arg1, arg2; 455 register Lisp_Object arg1, arg2;
456{ 456{
457 double f1, f2; 457 double f1, f2, f3;
458 458
459 CHECK_NUMBER_OR_FLOAT (arg1); 459 CHECK_NUMBER_OR_FLOAT (arg1);
460 CHECK_NUMBER_OR_FLOAT (arg2); 460 CHECK_NUMBER_OR_FLOAT (arg2);
@@ -500,8 +500,11 @@ DEFUN ("expt", Fexpt, Sexpt, 2, 2, 0,
500 else if ((f1 == 0.0 && f2 < 0.0) || (f1 < 0 && f2 != floor(f2))) 500 else if ((f1 == 0.0 && f2 < 0.0) || (f1 < 0 && f2 != floor(f2)))
501 domain_error2 ("expt", arg1, arg2); 501 domain_error2 ("expt", arg1, arg2);
502#endif 502#endif
503 IN_FLOAT2 (f1 = pow (f1, f2), "expt", arg1, arg2); 503 IN_FLOAT2 (f3 = pow (f1, f2), "expt", arg1, arg2);
504 return make_float (f1); 504 /* Check for overflow in the result. */
505 if (f1 != 0.0 && f3 == 0.0)
506 range_error ("expt", arg1);
507 return make_float (f3);
505} 508}
506 509
507DEFUN ("log", Flog, Slog, 1, 2, 0, 510DEFUN ("log", Flog, Slog, 1, 2, 0,