trunc

Returns the integer portion of x, dropping the fractional portion. This is also known as "chop" rounding. pure on all platforms.

@trusted nothrow @nogc pure
real
trunc
(
real x
)

Examples

assert(trunc(0.01) == 0);
assert(trunc(0.49) == 0);
assert(trunc(0.5) == 0);
assert(trunc(1.5) == 1);

Meta