<xstd/ints/cstdlib/div_ceil.hpp>¶
xstd::div_ceil¶
template<integer I>
constexpr auto div_ceil(I numer, I denom) noexcept(nothrow_const_operators<I>) -> div_result<I>;
The quotient and remainder of integer division rounded toward positive infinity.
Parameters¶
| Parameter | Meaning |
|---|---|
numer |
the numerator |
denom |
the denominator |
Preconditions: As for div.
Return value¶
- Returns: For a signed
I,{.quotient = q, .remainder = numer - denom * q}, whereqisnumer / denomrounded toward positive infinity:|remainder| < |denom|, and a nonzero remainder has the sign opposite todenom's. - Returns: For an unsigned
I, the sameq, withnumer - denom * qreduced modulo 2N for the width N ofIas the remainder, as P3724R4'sdiv_rem_to_pos_infwords it: an inexact quotient still rounds up, andnumer == denom * quotient + remainderholds inI's own arithmetic.
Exceptions¶
The exception specification is nothrow_const_operators<I>.
Notes¶
- The quotient is one more than
div_floor's wherever that leaves a remainder, and equal to it elsewhere. - A call is a constant expression wherever
I's own/and%are.
See also¶
| Entity | Relation |
|---|---|
div_result |
the result type |
div, div_euclid, div_floor |
the other roundings |