• Hans Boehm's avatar
    Correct off-by-1 errors in display formatting code. · 5e802f30
    Hans Boehm authored
    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.  (T...
    5e802f30
README.txt 1.72 KB