Returns num/denom, rounded away from zero. If num and denom are non-zero and have different signs (so the unrounded fraction num/denom is negative), returns divFloor, otherwise returns divCeil. If T is an unsigned type then this is always equal to divCeil.
Declared in <folly/Math.h>
template<
typename N,
typename D>
constexpr
/* implementation-defined */
divRoundAway(
N num,
D denom);
This function undergoes the same integer promotion rules as a built-in operator, except that we don't allow bool -> int promotion. This function is undefined if denom == 0. It is also undefined if the result type T is a signed type, num is std::numeric_limits<T>::min(), and denom is equal to -1 after conversion to the result type.
num/denom, rounded away from zero.
| Name | Description |
|---|---|
| num | The dividend. |
| denom | The divisor. |