Misleading comment
'toward zero' is confusing since it can round up or down. The correct comment is 'round half up, to the nearest integer'. Closes #2330
This commit is contained in:
parent
d81f230680
commit
f35d2d892d
1 changed files with 1 additions and 1 deletions
|
@ -46,7 +46,7 @@ inline int bounded_add(int base, int increment, int max_sum, int min_sum=0) {
|
||||||
return std::max(base+increment, std::min(base, min_sum));
|
return std::max(base+increment, std::min(base, min_sum));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Guarantees portable results for division by 100; round towards 0 */
|
/** Guarantees portable results for division by 100; round half up, to the nearest integer. */
|
||||||
inline int div100rounded(int num) {
|
inline int div100rounded(int num) {
|
||||||
return (num < 0) ? -(((-num) + 50) / 100) : (num + 50) / 100;
|
return (num < 0) ? -(((-num) + 50) / 100) : (num + 50) / 100;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue