Originally Posted by
MountLag
Oh so it returned 162 instead of rounding up to 163, due to 162 being even. Well there's the problem lol.
edit: from your link, in case it wasn't clear what I was referring to.
Well darn, I missed that detail. Thanks. I guess I should have read the docs more closely. That sort of rounding behavior isn't intuitive at all, but there's no excuse for me to have missed that.
Substituted round for roundNearest where roundNearest is
Code:
roundNearest x =
let (whole, frac) = properFraction x in
if frac >= 0.5 then whole + 1 else whole
(Aware that this doesn't work for negative numbers.)
All is fine now.
Bookmarks