[libc-commits] [PATCH] D119156: [libc] Fix mixed-sign comparison warnings and an out-of-bound access in high_precision_decimal.h
Michael Jones via Phabricator via libc-commits
libc-commits at lists.llvm.org
Mon Feb 7 10:14:21 PST 2022
michaelrj added inline comments.
Comment at: libc/src/__support/high_precision_decimal.h:131
// If this exactly halfway, round to even.
+ if (roundToDigit == 0)
+ // When the input is ".5".
I think that instead of having this, you could change the condition at the start of the function from `roundToDigit < 0` to `roundToDigit <= 0`, and it would have a more useful effect. If we're requesting 0 digits, then it should always round down, even if it's truncated.
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
More information about the libc-commits