aboutsummaryrefslogtreecommitdiffstats
path: root/src/floatfns.c
diff options
context:
space:
mode:
authorTom Tromey2018-07-06 21:56:17 -0600
committerTom Tromey2018-07-12 22:12:27 -0600
commit42fe787b0f26c2df682b2797407a669ef8522ccb (patch)
treee944fe465e2b65703a8361bc82647faf4f7907f1 /src/floatfns.c
parent01dbf2a347944497fdcf2ec156f4605020d7ba2a (diff)
downloademacs-42fe787b0f26c2df682b2797407a669ef8522ccb.tar.gz
emacs-42fe787b0f26c2df682b2797407a669ef8522ccb.zip
Rename integerp->fixnum, etc, in preparation for bignums
* src/json.c, src/keyboard.c, src/keyboard.h, src/keymap.c, src/kqueue.c, src/lcms.c, src/lisp.h, src/lread.c, src/macros.c, src/marker.c, src/menu.c, src/minibuf.c, src/msdos.c, src/print.c, src/process.c, src/profiler.c, src/search.c, src/sound.c, src/syntax.c, src/sysdep.c, src/term.c, src/terminal.c, src/textprop.c, src/undo.c, src/w16select.c, src/w32.c, src/w32console.c, src/w32cygwinx.c, src/w32fns.c, src/w32font.c, src/w32inevt.c, src/w32proc.c, src/w32select.c, src/w32term.c, src/w32uniscribe.c, src/widget.c, src/window.c, src/xdisp.c, src/xfaces.c, src/xfns.c, src/xfont.c, src/xftfont.c, src/xmenu.c, src/xrdb.c, src/xselect.c, src/xterm.c, src/xwidget.c: Rename INTEGERP->FIXNUM, make_number->make_fixnum, CHECK_NUMBER->CHECK_FIXNUM, make_natnum->make_fixed_natum, NUMBERP->FIXED_OR_FLOATP, NATNUMP->FIXNATP, CHECK_NATNUM->CHECK_FIXNAT.
Diffstat (limited to 'src/floatfns.c')
-rw-r--r--src/floatfns.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/floatfns.c b/src/floatfns.c
index e7d404a84e0..766044ba35c 100644
--- a/src/floatfns.c
+++ b/src/floatfns.c
@@ -67,7 +67,7 @@ CHECK_FLOAT (Lisp_Object x)
67double 67double
68extract_float (Lisp_Object num) 68extract_float (Lisp_Object num)
69{ 69{
70 CHECK_NUMBER_OR_FLOAT (num); 70 CHECK_FIXNUM_OR_FLOAT (num);
71 return XFLOATINT (num); 71 return XFLOATINT (num);
72} 72}
73 73
@@ -185,7 +185,7 @@ If X is zero, both parts (SGNFCAND and EXP) are zero. */)
185 double f = extract_float (x); 185 double f = extract_float (x);
186 int exponent; 186 int exponent;
187 double sgnfcand = frexp (f, &exponent); 187 double sgnfcand = frexp (f, &exponent);
188 return Fcons (make_float (sgnfcand), make_number (exponent)); 188 return Fcons (make_float (sgnfcand), make_fixnum (exponent));
189} 189}
190 190
191DEFUN ("ldexp", Fldexp, Sldexp, 2, 2, 0, 191DEFUN ("ldexp", Fldexp, Sldexp, 2, 2, 0,
@@ -193,7 +193,7 @@ DEFUN ("ldexp", Fldexp, Sldexp, 2, 2, 0,
193EXPONENT must be an integer. */) 193EXPONENT must be an integer. */)
194 (Lisp_Object sgnfcand, Lisp_Object exponent) 194 (Lisp_Object sgnfcand, Lisp_Object exponent)
195{ 195{
196 CHECK_NUMBER (exponent); 196 CHECK_FIXNUM (exponent);
197 int e = min (max (INT_MIN, XINT (exponent)), INT_MAX); 197 int e = min (max (INT_MIN, XINT (exponent)), INT_MAX);
198 return make_float (ldexp (extract_float (sgnfcand), e)); 198 return make_float (ldexp (extract_float (sgnfcand), e));
199} 199}
@@ -211,10 +211,10 @@ DEFUN ("expt", Fexpt, Sexpt, 2, 2, 0,
211 doc: /* Return the exponential ARG1 ** ARG2. */) 211 doc: /* Return the exponential ARG1 ** ARG2. */)
212 (Lisp_Object arg1, Lisp_Object arg2) 212 (Lisp_Object arg1, Lisp_Object arg2)
213{ 213{
214 CHECK_NUMBER_OR_FLOAT (arg1); 214 CHECK_FIXNUM_OR_FLOAT (arg1);
215 CHECK_NUMBER_OR_FLOAT (arg2); 215 CHECK_FIXNUM_OR_FLOAT (arg2);
216 if (INTEGERP (arg1) /* common lisp spec */ 216 if (FIXNUMP (arg1) /* common lisp spec */
217 && INTEGERP (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 && XINT (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 */
@@ -275,7 +275,7 @@ DEFUN ("abs", Fabs, Sabs, 1, 1, 0,
275 doc: /* Return the absolute value of ARG. */) 275 doc: /* Return the absolute value of ARG. */)
276 (register Lisp_Object arg) 276 (register Lisp_Object arg)
277{ 277{
278 CHECK_NUMBER_OR_FLOAT (arg); 278 CHECK_FIXNUM_OR_FLOAT (arg);
279 279
280 if (FLOATP (arg)) 280 if (FLOATP (arg))
281 arg = make_float (fabs (XFLOAT_DATA (arg))); 281 arg = make_float (fabs (XFLOAT_DATA (arg)));
@@ -289,9 +289,9 @@ DEFUN ("float", Ffloat, Sfloat, 1, 1, 0,
289 doc: /* Return the floating point number equal to ARG. */) 289 doc: /* Return the floating point number equal to ARG. */)
290 (register Lisp_Object arg) 290 (register Lisp_Object arg)
291{ 291{
292 CHECK_NUMBER_OR_FLOAT (arg); 292 CHECK_FIXNUM_OR_FLOAT (arg);
293 293
294 if (INTEGERP (arg)) 294 if (FIXNUMP (arg))
295 return make_float ((double) XINT (arg)); 295 return make_float ((double) XINT (arg));
296 else /* give 'em the same float back */ 296 else /* give 'em the same float back */
297 return arg; 297 return arg;
@@ -311,7 +311,7 @@ This is the same as the exponent of a float. */)
311 (Lisp_Object arg) 311 (Lisp_Object arg)
312{ 312{
313 EMACS_INT value; 313 EMACS_INT value;
314 CHECK_NUMBER_OR_FLOAT (arg); 314 CHECK_FIXNUM_OR_FLOAT (arg);
315 315
316 if (FLOATP (arg)) 316 if (FLOATP (arg))
317 { 317 {
@@ -336,7 +336,7 @@ This is the same as the exponent of a float. */)
336 : EMACS_UINT_WIDTH - 1 - ecount_leading_zeros (i)); 336 : EMACS_UINT_WIDTH - 1 - ecount_leading_zeros (i));
337 } 337 }
338 338
339 return make_number (value); 339 return make_fixnum (value);
340} 340}
341 341
342 342
@@ -348,7 +348,7 @@ rounding_driver (Lisp_Object arg, Lisp_Object divisor,
348 EMACS_INT (*int_round2) (EMACS_INT, EMACS_INT), 348 EMACS_INT (*int_round2) (EMACS_INT, EMACS_INT),
349 const char *name) 349 const char *name)
350{ 350{
351 CHECK_NUMBER_OR_FLOAT (arg); 351 CHECK_FIXNUM_OR_FLOAT (arg);
352 352
353 double d; 353 double d;
354 if (NILP (divisor)) 354 if (NILP (divisor))
@@ -359,12 +359,12 @@ rounding_driver (Lisp_Object arg, Lisp_Object divisor,
359 } 359 }
360 else 360 else
361 { 361 {
362 CHECK_NUMBER_OR_FLOAT (divisor); 362 CHECK_FIXNUM_OR_FLOAT (divisor);
363 if (!FLOATP (arg) && !FLOATP (divisor)) 363 if (!FLOATP (arg) && !FLOATP (divisor))
364 { 364 {
365 if (XINT (divisor) == 0) 365 if (XINT (divisor) == 0)
366 xsignal0 (Qarith_error); 366 xsignal0 (Qarith_error);
367 return make_number (int_round2 (XINT (arg), XINT (divisor))); 367 return make_fixnum (int_round2 (XINT (arg), XINT (divisor)));
368 } 368 }
369 369
370 double f1 = FLOATP (arg) ? XFLOAT_DATA (arg) : XINT (arg); 370 double f1 = FLOATP (arg) ? XFLOAT_DATA (arg) : XINT (arg);
@@ -383,7 +383,7 @@ rounding_driver (Lisp_Object arg, Lisp_Object divisor,
383 { 383 {
384 EMACS_INT ir = dr; 384 EMACS_INT ir = dr;
385 if (! FIXNUM_OVERFLOW_P (ir)) 385 if (! FIXNUM_OVERFLOW_P (ir))
386 return make_number (ir); 386 return make_fixnum (ir);
387 } 387 }
388 xsignal2 (Qrange_error, build_string (name), arg); 388 xsignal2 (Qrange_error, build_string (name), arg);
389} 389}