floor

Converts a floating point value to an integer.

This function requires the SSE2 instruction set and it can't be inlined.

int
floor
@trusted pure nothrow
(
T
)
()
if (
isFloatingPoint!T
)

Parameters

value
Type: T

Either a float or a double.

Return Value

Type: int

The largest integral value that is not greater than value.

Examples

assert(floor(0.2f) == 0);
assert(floor(0.8f) == 0);
assert(floor(-0.2f) == -1);
assert(floor(-0.8f) == -1);

Meta