round

Return the value of x rounded to the nearest integer. If the fractional part of x is exactly 0.5, the return value is rounded away from zero.

@trusted nothrow @nogc
round
(
real x
)

Return Value

Type: auto

A real.

Examples

assert(round(4.5) == 5);
assert(round(5.4) == 5);
assert(round(-4.5) == -5);
assert(round(-5.1) == -5);

Meta