Definition
Nearest integer
An integer minimizing distance to a given real number, with a stated tie convention.
A nearest integer to is an integer minimizing the absolute value . It always satisfies . The minimizer is unique unless is halfway between two consecutive integers.
A convention
One deterministic rule is , which resolves a tie toward the larger integer. Other rules, such as rounding ties to an even integer, must be specified if used. A nearest nonzero integer minimizes over and can differ from ordinary rounding near zero; a tie between and occurs at zero.
Example
The nearest integer to is , while both and minimize distance to . Rounding is a discrete selection operation, so differentiability cannot be assumed at the selection boundaries.