diff options
| author | Paul Eggert <eggert@cs.ucla.edu> | 2017-03-05 13:29:28 -0800 |
|---|---|---|
| committer | Paul Eggert <eggert@cs.ucla.edu> | 2017-03-05 13:31:33 -0800 |
| commit | 53f3dd66f12660a47018fc03d50d460787ab6f64 (patch) | |
| tree | ba06844571bec80b8f0258aee30640790e73b918 /src/floatfns.c | |
| parent | 788a5b8447253fdbbb171d3219acbd7600bb465a (diff) | |
| download | emacs-53f3dd66f12660a47018fc03d50d460787ab6f64.tar.gz | |
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.c | 16 |
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, \(Round toward +inf.) */) (Lisp_Object arg) { - double d = extract_float (arg); + CHECK_FLOAT (arg); + double d = XFLOAT_DATA (arg); d = ceil (d); return make_float (d); } DEFUN ("ffloor", Fffloor, Sffloor, 1, 1, 0, doc: /* Return the largest integer no greater than ARG, as a float. -\(Round towards -inf.) */) +\(Round toward -inf.) */) (Lisp_Object arg) { - double d = extract_float (arg); + CHECK_FLOAT (arg); + double d = XFLOAT_DATA (arg); d = floor (d); return make_float (d); } @@ -523,17 +525,19 @@ DEFUN ("fround", Ffround, Sfround, 1, 1, 0, doc: /* Return the nearest integer to ARG, as a float. */) (Lisp_Object arg) { - double d = extract_float (arg); + CHECK_FLOAT (arg); + double d = XFLOAT_DATA (arg); d = emacs_rint (d); return make_float (d); } DEFUN ("ftruncate", Fftruncate, Sftruncate, 1, 1, 0, doc: /* Truncate a floating point number to an integral float value. -Rounds the value toward zero. */) +\(Round toward zero.) */) (Lisp_Object arg) { - double d = extract_float (arg); + CHECK_FLOAT (arg); + double d = XFLOAT_DATA (arg); d = emacs_trunc (d); return make_float (d); } |
