Fix mixed-sign comparison warnings and an out-of-bound access in high_precision_decimal.h
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
libc/src/__support/high_precision_decimal.h | ||
---|---|---|
131 | 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. |
libc/src/__support/high_precision_decimal.h | ||
---|---|---|
131 | Then it will return false for something that needs roundup like ".51". |
Comment Actions
LGTM
libc/src/__support/high_precision_decimal.h | ||
---|---|---|
131 | ah, yes, I see what you mean, nevermind then. |
Comment Actions
as an additional part of this patch, could you add
`simple_decimal_conversion_test<float>(
"7.00649232162408535461864791644958065640130970938257885878534141944895541342930300743319094181060791015625e-46", 0x0, 0, ERANGE);`
to line 235 of str_to_float_test.cpp?
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.