Round

Round[x]

gives the integer closest to x.

Round[x,a]

rounds to the nearest multiple of a.

Details

  • Mathematical function, suitable for both symbolic and numerical manipulation.
  • Round rounds numbers of the form x .5 toward the nearest even integer.
  • Round[x] returns an integer when x is any numeric quantity, whether or not it is an explicit number.
  • For exact numeric quantities, Round internally uses numerical approximations to establish its result. This process can be affected by the setting of the global variable $MaxExtraPrecision.
  • Round applies separately to real and imaginary parts of complex numbers.
  • Round automatically threads over lists.

Examples

open allclose all

Basic Examples  (3)

Round to the nearest integer:

Round to the nearest multiple of 10:

Plot the function over a subset of the reals:

Scope  (24)

Numerical Evaluation  (7)

Evaluate numerically:

Value at two consecutive half-integers:

Complex number inputs:

Single-argument Round always returns an exact result:

The two-argument form tracks the precision of the second argument:

Evaluate efficiently at high precision:

Round threads elementwise over lists:

Round can deal with realvalued intervals:

Specific Values  (6)

Values of Round at fixed points:

Value at 0:

Value at Infinity:

Evaluate symbolically:

Manipulate Round symbolically:

Find a value of x for which Round[x,2]=2:

Visualization  (4)

Plot the Round function:

Visualize the two-argument form:

Plot Round in three dimensions:

Visualize Round in the complex plane:

Function Properties  (3)

Round is defined for all real and complex inputs:

Round can produce infinitely large and small results:

Round is an odd function:

Differentiation and Integration  (4)

First derivative with respect to x:

First derivative with respect to a:

Evaluate an integral:

Series expansion:

Applications  (1)

Compute Fibonacci numbers:

Properties & Relations  (5)

Negative numbers also round to the nearest integer:

At midpoints, Round rounds towards even integers:

Possible Issues  (1)

Round does not automatically resolve the value:

Introduced in 1988
 (1.0)
 |
Updated in 1996
 (3.0)
2007
 (6.0)