[libc-commits] [PATCH] D119156: [libc] Fix mixed-sign comparison warnings and an out-of-bound access in high_precision_decimal.h
Tue Ly via Phabricator via libc-commits
libc-commits at lists.llvm.org
Mon Feb 7 10:17:59 PST 2022
lntue 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".
----------------
michaelrj wrote:
> 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.
Then it will return false for something that needs roundup like ".51".
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D119156/new/
https://reviews.llvm.org/D119156
More information about the libc-commits
mailing list