aboutsummaryrefslogtreecommitdiffstats
path: root/src/floatfns.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/floatfns.c')
-rw-r--r--src/floatfns.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/floatfns.c b/src/floatfns.c
index 645a5957609..6113758f964 100644
--- a/src/floatfns.c
+++ b/src/floatfns.c
@@ -1,7 +1,7 @@
1/* Primitive operations on floating point for GNU Emacs Lisp interpreter. 1/* Primitive operations on floating point for GNU Emacs Lisp interpreter.
2 2
3Copyright (C) 1988, 1993-1994, 1999, 2001-2012 3Copyright (C) 1988, 1993-1994, 1999, 2001-2013 Free Software Foundation,
4 Free Software Foundation, Inc. 4Inc.
5 5
6Author: Wolfgang Rupprecht 6Author: Wolfgang Rupprecht
7(according to ack.texi) 7(according to ack.texi)
@@ -193,7 +193,7 @@ DEFUN ("expt", Fexpt, Sexpt, 2, 2, 0,
193 CHECK_NUMBER_OR_FLOAT (arg2); 193 CHECK_NUMBER_OR_FLOAT (arg2);
194 if (INTEGERP (arg1) /* common lisp spec */ 194 if (INTEGERP (arg1) /* common lisp spec */
195 && INTEGERP (arg2) /* don't promote, if both are ints, and */ 195 && INTEGERP (arg2) /* don't promote, if both are ints, and */
196 && 0 <= XINT (arg2)) /* we are sure the result is not fractional */ 196 && XINT (arg2) >= 0) /* we are sure the result is not fractional */
197 { /* this can be improved by pre-calculating */ 197 { /* this can be improved by pre-calculating */
198 EMACS_INT y; /* some binary powers of x then accumulating */ 198 EMACS_INT y; /* some binary powers of x then accumulating */
199 EMACS_UINT acc, x; /* Unsigned so that overflow is well defined. */ 199 EMACS_UINT acc, x; /* Unsigned so that overflow is well defined. */
@@ -399,8 +399,8 @@ round2 (EMACS_INT i1, EMACS_INT i2)
399 odd. */ 399 odd. */
400 EMACS_INT q = i1 / i2; 400 EMACS_INT q = i1 / i2;
401 EMACS_INT r = i1 % i2; 401 EMACS_INT r = i1 % i2;
402 EMACS_INT abs_r = r < 0 ? -r : r; 402 EMACS_INT abs_r = eabs (r);
403 EMACS_INT abs_r1 = (i2 < 0 ? -i2 : i2) - abs_r; 403 EMACS_INT abs_r1 = eabs (i2) - abs_r;
404 return q + (abs_r + (q & 1) <= abs_r1 ? 0 : (i2 ^ r) < 0 ? -1 : 1); 404 return q + (abs_r + (q & 1) <= abs_r1 ? 0 : (i2 ^ r) < 0 ? -1 : 1);
405} 405}
406 406
@@ -475,7 +475,7 @@ fmod_float (Lisp_Object x, Lisp_Object y)
475 f1 = fmod (f1, f2); 475 f1 = fmod (f1, f2);
476 476
477 /* If the "remainder" comes out with the wrong sign, fix it. */ 477 /* If the "remainder" comes out with the wrong sign, fix it. */
478 if (f2 < 0 ? 0 < f1 : f1 < 0) 478 if (f2 < 0 ? f1 > 0 : f1 < 0)
479 f1 += f2; 479 f1 += f2;
480 480
481 return make_float (f1); 481 return make_float (f1);