Correct off-by-1 errors in display formatting code.
Bug: 21986868 Bug: 21960281 Fix and restructure the formatting and scroll-limit-calculation code. This code is inherently tricky, and has had more bugs than we would like to admit to. Use the opportunity to clean up the code a bit, renaming variables consistently. The good news is that the code seems to be getting slightly simpler with each bug fix. This fixes several separate off-by-one errors related to result formatting: The expLen() exponent string length calculation was off by 1 for exact powers of 10. The dropDigits calculation in the formatting code was off for negative exponents just shorter than an exact power of 10. The exponent space calculation for a few results like -1.2*10^-8 was off by one. For a result like -10^-500 we did not reserve space for the leading minus sign, since that's not computed until after scrolling. [Less serious] The ellipses were omitted when we had just barely scrolled a leading minus sign off the screen. (This only occurred in exactly one position, which could never be the default one.) Change-Id: If1bfbbb70a624998be3d996592d129b16aade745
Loading
Please register or sign in to comment