[libc-commits] [PATCH] D118791: [libc][Obvious] Fix a mismatch signature of HighPrecisionDecimal::should_round_up.

Michael Jones via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu Feb 3 14:18:11 PST 2022


michaelrj requested changes to this revision.
michaelrj added a comment.
This revision now requires changes to proceed.

This is incorrect, should_round_up is called on `decimal_point` which is specifically signed because it represents the index of where the decimal point should be, relative to the digits. Specifically a negative decimal point represents a number that is less than 1. There is an if statement on line 115 to handle if roundToDigit is negative. While the code will still work if this change is made (any reasonable negative number will create an unsigned number greater than `this->num_digits`) it would make the code less correct.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118791/new/

https://reviews.llvm.org/D118791



More information about the libc-commits mailing list