aboutsummaryrefslogtreecommitdiffstats
path: root/src/floatfns.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/floatfns.c')
-rw-r--r--src/floatfns.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/floatfns.c b/src/floatfns.c
index 563c65f827a..f8463f32445 100644
--- a/src/floatfns.c
+++ b/src/floatfns.c
@@ -194,7 +194,7 @@ EXPONENT must be an integer. */)
194 (Lisp_Object sgnfcand, Lisp_Object exponent) 194 (Lisp_Object sgnfcand, Lisp_Object exponent)
195{ 195{
196 CHECK_FIXNUM (exponent); 196 CHECK_FIXNUM (exponent);
197 int e = min (max (INT_MIN, XINT (exponent)), INT_MAX); 197 int e = min (max (INT_MIN, XFIXNUM (exponent)), INT_MAX);
198 return make_float (ldexp (extract_float (sgnfcand), e)); 198 return make_float (ldexp (extract_float (sgnfcand), e));
199} 199}
200 200
@@ -215,14 +215,14 @@ DEFUN ("expt", Fexpt, Sexpt, 2, 2, 0,
215 CHECK_FIXNUM_OR_FLOAT (arg2); 215 CHECK_FIXNUM_OR_FLOAT (arg2);
216 if (FIXNUMP (arg1) /* common lisp spec */ 216 if (FIXNUMP (arg1) /* common lisp spec */
217 && FIXNUMP (arg2) /* don't promote, if both are ints, and */ 217 && FIXNUMP (arg2) /* don't promote, if both are ints, and */
218 && XINT (arg2) >= 0) /* we are sure the result is not fractional */ 218 && XFIXNUM (arg2) >= 0) /* we are sure the result is not fractional */
219 { /* this can be improved by pre-calculating */ 219 { /* this can be improved by pre-calculating */
220 EMACS_INT y; /* some binary powers of x then accumulating */ 220 EMACS_INT y; /* some binary powers of x then accumulating */
221 EMACS_UINT acc, x; /* Unsigned so that overflow is well defined. */ 221 EMACS_UINT acc, x; /* Unsigned so that overflow is well defined. */
222 Lisp_Object val; 222 Lisp_Object val;
223 223
224 x = XINT (arg1); 224 x = XFIXNUM (arg1);
225 y = XINT (arg2); 225 y = XFIXNUM (arg2);
226 acc = (y & 1 ? x : 1); 226 acc = (y & 1 ? x : 1);
227 227
228 while ((y >>= 1) != 0) 228 while ((y >>= 1) != 0)
@@ -285,7 +285,7 @@ DEFUN ("abs", Fabs, Sabs, 1, 1, 0,
285 arg = make_number (val); 285 arg = make_number (val);
286 mpz_clear (val); 286 mpz_clear (val);
287 } 287 }
288 else if (FIXNUMP (arg) && XINT (arg) == MOST_NEGATIVE_FIXNUM) 288 else if (FIXNUMP (arg) && XFIXNUM (arg) == MOST_NEGATIVE_FIXNUM)
289 { 289 {
290 mpz_t val; 290 mpz_t val;
291 mpz_init (val); 291 mpz_init (val);
@@ -295,8 +295,8 @@ DEFUN ("abs", Fabs, Sabs, 1, 1, 0,
295 } 295 }
296 else if (FLOATP (arg)) 296 else if (FLOATP (arg))
297 arg = make_float (fabs (XFLOAT_DATA (arg))); 297 arg = make_float (fabs (XFLOAT_DATA (arg)));
298 else if (XINT (arg) < 0) 298 else if (XFIXNUM (arg) < 0)
299 XSETINT (arg, - XINT (arg)); 299 XSETINT (arg, - XFIXNUM (arg));
300 300
301 return arg; 301 return arg;
302} 302}
@@ -310,7 +310,7 @@ DEFUN ("float", Ffloat, Sfloat, 1, 1, 0,
310 if (BIGNUMP (arg)) 310 if (BIGNUMP (arg))
311 return make_float (mpz_get_d (XBIGNUM (arg)->value)); 311 return make_float (mpz_get_d (XBIGNUM (arg)->value));
312 if (FIXNUMP (arg)) 312 if (FIXNUMP (arg))
313 return make_float ((double) XINT (arg)); 313 return make_float ((double) XFIXNUM (arg));
314 else /* give 'em the same float back */ 314 else /* give 'em the same float back */
315 return arg; 315 return arg;
316} 316}
@@ -351,7 +351,7 @@ This is the same as the exponent of a float. */)
351 else 351 else
352 { 352 {
353 eassert (FIXNUMP (arg)); 353 eassert (FIXNUMP (arg));
354 EMACS_INT i = eabs (XINT (arg)); 354 EMACS_INT i = eabs (XFIXNUM (arg));
355 value = (i == 0 355 value = (i == 0
356 ? MOST_NEGATIVE_FIXNUM 356 ? MOST_NEGATIVE_FIXNUM
357 : EMACS_UINT_WIDTH - 1 - ecount_leading_zeros (i)); 357 : EMACS_UINT_WIDTH - 1 - ecount_leading_zeros (i));
@@ -383,13 +383,13 @@ rounding_driver (Lisp_Object arg, Lisp_Object divisor,
383 CHECK_FIXNUM_OR_FLOAT (divisor); 383 CHECK_FIXNUM_OR_FLOAT (divisor);
384 if (!FLOATP (arg) && !FLOATP (divisor)) 384 if (!FLOATP (arg) && !FLOATP (divisor))
385 { 385 {
386 if (XINT (divisor) == 0) 386 if (XFIXNUM (divisor) == 0)
387 xsignal0 (Qarith_error); 387 xsignal0 (Qarith_error);
388 return make_fixnum (int_round2 (XINT (arg), XINT (divisor))); 388 return make_fixnum (int_round2 (XFIXNUM (arg), XFIXNUM (divisor)));
389 } 389 }
390 390
391 double f1 = FLOATP (arg) ? XFLOAT_DATA (arg) : XINT (arg); 391 double f1 = FLOATP (arg) ? XFLOAT_DATA (arg) : XFIXNUM (arg);
392 double f2 = FLOATP (divisor) ? XFLOAT_DATA (divisor) : XINT (divisor); 392 double f2 = FLOATP (divisor) ? XFLOAT_DATA (divisor) : XFIXNUM (divisor);
393 if (! IEEE_FLOATING_POINT && f2 == 0) 393 if (! IEEE_FLOATING_POINT && f2 == 0)
394 xsignal0 (Qarith_error); 394 xsignal0 (Qarith_error);
395 d = f1 / f2; 395 d = f1 / f2;
@@ -510,8 +510,8 @@ fmod_float (Lisp_Object x, Lisp_Object y)
510{ 510{
511 double f1, f2; 511 double f1, f2;
512 512
513 f1 = FLOATP (x) ? XFLOAT_DATA (x) : XINT (x); 513 f1 = FLOATP (x) ? XFLOAT_DATA (x) : XFIXNUM (x);
514 f2 = FLOATP (y) ? XFLOAT_DATA (y) : XINT (y); 514 f2 = FLOATP (y) ? XFLOAT_DATA (y) : XFIXNUM (y);
515 515
516 f1 = fmod (f1, f2); 516 f1 = fmod (f1, f2);
517 517