diff options
author | be_ <be.0@gmx.com> | 2017-05-28 14:26:04 -0500 |
---|---|---|
committer | be_ <be.0@gmx.com> | 2017-05-28 14:26:04 -0500 |
commit | 963c3849614942a5eeb68a1f4da1a3de6596cbb0 (patch) | |
tree | 35cfbb6aec8b611af52b1faee7dcd6528f859b15 /src/util/math.h | |
parent | 1c9c5a1da5f494c881bcd62b40ea3a2f1256f696 (diff) |
make roundToFraction round to nearest instead of clamp down
Diffstat (limited to 'src/util/math.h')
-rw-r--r-- | src/util/math.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/util/math.h b/src/util/math.h index 5547c98649..aa9cd54717 100644 --- a/src/util/math.h +++ b/src/util/math.h @@ -68,7 +68,7 @@ inline int roundUpToPowerOf2(int v) { inline double roundToFraction(double value, int denominator) { int wholePart = value; double fractionPart = value - wholePart; - int numerator = fractionPart * denominator; + int numerator = std::lround(fractionPart * denominator); return wholePart + (double) numerator / (double) denominator; } |