+DEFUN ("floor", Ffloor, Sfloor, 1, 2, 0,
+ doc: /* Return the largest integer no greater than ARG.
+This rounds the value towards -inf.
+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,
+ doc: /* Return the nearest integer to ARG.
+With optional DIVISOR, return the nearest integer to ARG/DIVISOR.
+
+Rounding a value equidistant between two integers may choose the
+integer closer to zero, or it may prefer an even integer, depending on
+your machine. For example, \(round 2.5\) can return 3 on some
+systems, but 2 on others. */)
+ (arg, divisor)
+ Lisp_Object arg, divisor;
+{
+ return rounding_driver (arg, divisor, emacs_rint, round2, "round");
+}
+
+DEFUN ("truncate", Ftruncate, Struncate, 1, 2, 0,
+ doc: /* Truncate a floating point number to an int.
+Rounds ARG toward zero.
+With optional DIVISOR, truncate ARG/DIVISOR. */)
+ (arg, divisor)
+ Lisp_Object arg, divisor;
+{
+ return rounding_driver (arg, divisor, double_identity, truncate2,
+ "truncate");
+}
+
+
+Lisp_Object
+fmod_float (x, y)
+ register Lisp_Object x, y;
+{
+ double f1, f2;
+
+ f1 = FLOATP (x) ? XFLOAT_DATA (x) : XINT (x);
+ f2 = FLOATP (y) ? XFLOAT_DATA (y) : XINT (y);
+
+ if (! IEEE_FLOATING_POINT && f2 == 0)
+ Fsignal (Qarith_error, Qnil);
+
+ /* If the "remainder" comes out with the wrong sign, fix it. */
+ IN_FLOAT2 ((f1 = fmod (f1, f2),
+ f1 = (f2 < 0 ? f1 > 0 : f1 < 0) ? f1 + f2 : f1),
+ "mod", x, y);
+ return make_float (f1);