aboutsummaryrefslogtreecommitdiffstats
path: root/src/floatfns.c
diff options
context:
space:
mode:
authorPaul Eggert2017-03-05 13:29:28 -0800
committerPaul Eggert2017-03-05 13:31:33 -0800
commit53f3dd66f12660a47018fc03d50d460787ab6f64 (patch)
treeba06844571bec80b8f0258aee30640790e73b918 /src/floatfns.c
parent788a5b8447253fdbbb171d3219acbd7600bb465a (diff)
downloademacs-53f3dd66f12660a47018fc03d50d460787ab6f64.tar.gz
emacs-53f3dd66f12660a47018fc03d50d460787ab6f64.zip
ffloor etc. now accept only floats
* etc/NEWS: Say why. * src/floatfns.c (Ffceiling, Fffloor, Ffround, Fftruncate): Require arg to be float. * test/src/floatfns-tests.el (fround-fixnum): Check this.
Diffstat (limited to 'src/floatfns.c')
-rw-r--r--src/floatfns.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/floatfns.c b/src/floatfns.c
index 9ae810669ef..4c09036ac79 100644
--- a/src/floatfns.c
+++ b/src/floatfns.c
@@ -504,17 +504,19 @@ DEFUN ("fceiling", Ffceiling, Sfceiling, 1, 1, 0,
504\(Round toward +inf.) */) 504\(Round toward +inf.) */)
505 (Lisp_Object arg) 505 (Lisp_Object arg)
506{ 506{
507 double d = extract_float (arg); 507 CHECK_FLOAT (arg);
508 double d = XFLOAT_DATA (arg);
508 d = ceil (d); 509 d = ceil (d);
509 return make_float (d); 510 return make_float (d);
510} 511}
511 512
512DEFUN ("ffloor", Fffloor, Sffloor, 1, 1, 0, 513DEFUN ("ffloor", Fffloor, Sffloor, 1, 1, 0,
513 doc: /* Return the largest integer no greater than ARG, as a float. 514 doc: /* Return the largest integer no greater than ARG, as a float.
514\(Round towards -inf.) */) 515\(Round toward -inf.) */)
515 (Lisp_Object arg) 516 (Lisp_Object arg)
516{ 517{
517 double d = extract_float (arg); 518 CHECK_FLOAT (arg);
519 double d = XFLOAT_DATA (arg);
518 d = floor (d); 520 d = floor (d);
519 return make_float (d); 521 return make_float (d);
520} 522}
@@ -523,17 +525,19 @@ DEFUN ("fround", Ffround, Sfround, 1, 1, 0,
523 doc: /* Return the nearest integer to ARG, as a float. */) 525 doc: /* Return the nearest integer to ARG, as a float. */)
524 (Lisp_Object arg) 526 (Lisp_Object arg)
525{ 527{
526 double d = extract_float (arg); 528 CHECK_FLOAT (arg);
529 double d = XFLOAT_DATA (arg);
527 d = emacs_rint (d); 530 d = emacs_rint (d);
528 return make_float (d); 531 return make_float (d);
529} 532}
530 533
531DEFUN ("ftruncate", Fftruncate, Sftruncate, 1, 1, 0, 534DEFUN ("ftruncate", Fftruncate, Sftruncate, 1, 1, 0,
532 doc: /* Truncate a floating point number to an integral float value. 535 doc: /* Truncate a floating point number to an integral float value.
533Rounds the value toward zero. */) 536\(Round toward zero.) */)
534 (Lisp_Object arg) 537 (Lisp_Object arg)
535{ 538{
536 double d = extract_float (arg); 539 CHECK_FLOAT (arg);
540 double d = XFLOAT_DATA (arg);
537 d = emacs_trunc (d); 541 d = emacs_trunc (d);
538 return make_float (d); 542 return make_float (d);
539} 543}