+/* The code uses emacs_rint, so that it works to undefine HAVE_RINT
+ if `rint' exists but does not work right. */
+#ifdef HAVE_RINT
+#define emacs_rint rint
+#else
+static double
+emacs_rint (d)
+ double d;
+{
+ return floor (d + 0.5);
+}
+#endif
+
+static double
+double_identity (d)
+ double d;
+{
+ return d;
+}
+
+DEFUN ("ceiling", Fceiling, Sceiling, 1, 2, 0,
+ "Return the smallest integer no less than ARG. (Round toward +inf.)\n\
+With optional DIVISOR, return the smallest integer no less than ARG/DIVISOR.")
+ (arg, divisor)
+ Lisp_Object arg, divisor;
+{
+ return rounding_driver (arg, divisor, ceil, ceiling2, "ceiling");
+}
+
+DEFUN ("floor", Ffloor, Sfloor, 1, 2, 0,
+ "Return the largest integer no greater than ARG. (Round towards -inf.)\n\
+With optional DIVISOR, return the largest integer no greater than ARG/DIVISOR.")
+ (arg, divisor)
+ Lisp_Object arg, divisor;
+{
+ return rounding_driver (arg, divisor, floor, floor2, "floor");
+}
+
+DEFUN ("round", Fround, Sround, 1, 2, 0,
+ "Return the nearest integer to ARG.\n\
+With optional DIVISOR, return the nearest integer to ARG/DIVISOR.")
+ (arg, divisor)
+ Lisp_Object arg, divisor;
+{
+ return rounding_driver (arg, divisor, emacs_rint, round2, "round");
+}
+
+DEFUN ("truncate", Ftruncate, Struncate, 1, 2, 0,