FloorDiv
Description
Returns the quotient rounded downward to the nearest integer.
Prototype
template <typename T> auto FloorDiv(T x, T y) -> typename std::enable_if<std::is_integral<T>::value, T>::type
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
x |
Input |
Dividend. |
y |
Input |
Divisor. |
Return Value
T: Returns the rounded-down division result. If the divisor is 0, the dividend is returned.
Constraints
The divisor and dividend must be integers of the same type (excluding the bool type).
Example
The following sample code is for reference only. Do not copy and run it.
1 | FloorDiv<int32_t>(10, 3) |
Parent topic: math