aboutsummaryrefslogtreecommitdiffstats
path: root/src/floatfns.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/floatfns.c')
-rw-r--r--src/floatfns.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/floatfns.c b/src/floatfns.c
index ec0349fbf40..e7d404a84e0 100644
--- a/src/floatfns.c
+++ b/src/floatfns.c
@@ -435,11 +435,9 @@ emacs_rint (double d)
435} 435}
436#endif 436#endif
437 437
438#ifdef HAVE_TRUNC 438#ifndef HAVE_TRUNC
439#define emacs_trunc trunc 439double
440#else 440trunc (double d)
441static double
442emacs_trunc (double d)
443{ 441{
444 return (d < 0 ? ceil : floor) (d); 442 return (d < 0 ? ceil : floor) (d);
445} 443}
@@ -482,8 +480,7 @@ Rounds ARG toward zero.
482With optional DIVISOR, truncate ARG/DIVISOR. */) 480With optional DIVISOR, truncate ARG/DIVISOR. */)
483 (Lisp_Object arg, Lisp_Object divisor) 481 (Lisp_Object arg, Lisp_Object divisor)
484{ 482{
485 return rounding_driver (arg, divisor, emacs_trunc, truncate2, 483 return rounding_driver (arg, divisor, trunc, truncate2, "truncate");
486 "truncate");
487} 484}
488 485
489 486
@@ -543,7 +540,7 @@ DEFUN ("ftruncate", Fftruncate, Sftruncate, 1, 1, 0,
543{ 540{
544 CHECK_FLOAT (arg); 541 CHECK_FLOAT (arg);
545 double d = XFLOAT_DATA (arg); 542 double d = XFLOAT_DATA (arg);
546 d = emacs_trunc (d); 543 d = trunc (d);
547 return make_float (d); 544 return make_float (d);
548} 545}
549 546