Bug 91579

Summary: Decimal constructor with 99999999999999999 loses last digit
Product: WebKit Reporter: yosin
Component: PlatformAssignee: yosin
Status: RESOLVED FIXED    
Severity: Normal CC: ap, tkent
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 91481    
Attachments:
Description Flags
Patch 1 none

Description yosin 2012-07-17 22:06:23 PDT
There is a bug in Decimal::EncodedData constructor with maximum coefficient, 99999999999999999, in following line:


Decimal::EncodedData::EncodedData(Sign sign, int exponent, uint64_t coefficient)
{
  ...
    if (exponent >= ExponentMin && exponent <= ExponentMax) {
        while (coefficient >= MaxCoefficient) { // *** BUG, we should use ">" instead of ">=".
            coefficient /= 10;
            ++exponent;
        }
    }
  ...
}
Comment 1 yosin 2012-07-17 22:22:34 PDT
Created attachment 152918 [details]
Patch 1
Comment 2 yosin 2012-07-17 22:23:31 PDT
Comment on attachment 152918 [details]
Patch 1

Could you review this patch?
Thanks in advance.
Comment 3 Kent Tamura 2012-07-17 22:36:10 PDT
Comment on attachment 152918 [details]
Patch 1

looks ok
Comment 4 yosin 2012-07-17 23:50:34 PDT
Comment on attachment 152918 [details]
Patch 1

Clearing flags on attachment: 152918

Committed r122922: <http://trac.webkit.org/changeset/122922>
Comment 5 yosin 2012-07-17 23:50:39 PDT
All reviewed patches have been landed.  Closing bug.
Comment 6 Alexey Proskuryakov 2012-07-18 10:41:43 PDT
This is fixing Platform code. Is that code used anywhere? An actual regression test would be vastly preferable to a unit test (which is not even cross-platform!)
Comment 7 yosin 2012-07-18 18:17:17 PDT
(In reply to comment #6)
> This is fixing Platform code. Is that code used anywhere? An actual regression test would be vastly preferable to a unit test (which is not even cross-platform!)

The code is used in step-able input types, number, date, range, datetime, and so on. Although, it is hard to hit this case from HTML5/JavaScript, because the value is out of range of double.

The purpose of fixing this is for test case (bug 91481) and that test case is supplement for LayoutTest.