Function: round

round is a function defined in floatfns.c.

Signature

(round ARG &optional DIVISOR)

Documentation

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.

Other relevant functions are documented in the number group.

View in manual

Shortdoc

;; number
(round 1.2)
    => 1
  (round -1.2)
    => -1
  (round 5.4 2)
    => 3

Source Code

// Defined in /usr/src/emacs/src/floatfns.c
{
  return rounding_driver (arg, divisor, emacs_rint, rounddiv_q, round2);
}