Changeset 34961 in webkit for trunk/JavaScriptCore


Ignore:
Timestamp:
Jul 2, 2008, 5:04:19 PM (17 years ago)
Author:
[email protected]
Message:

2008-07-02 Cameron Zwarich <[email protected]>

Reviewed by Darin.

Bug 19776: Number.toExponential() is incorrect for numbers between 0.1 and 1
<https://bugs.webkit.org/show_bug.cgi?id=19776>

Perform the sign check for the exponent on the actual exponent value,
which is 1 less than the value of decimalPoint, instead of on the value
of decimalPoint itself.

JavaScriptCore:

  • kjs/NumberPrototype.cpp: (KJS::exponentialPartToString):

LayoutTests:

  • fast/js/number-toExponential-expected.txt:
  • fast/js/resources/number-toExponential.js:
Location:
trunk/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r34960 r34961  
     12008-07-02  Cameron Zwarich  <[email protected]>
     2
     3        Reviewed by Darin.
     4
     5        Bug 19776: Number.toExponential() is incorrect for numbers between 0.1 and 1
     6        <https://bugs.webkit.org/show_bug.cgi?id=19776>
     7
     8        Perform the sign check for the exponent on the actual exponent value,
     9        which is 1 less than the value of decimalPoint, instead of on the value
     10        of decimalPoint itself.
     11
     12        * kjs/NumberPrototype.cpp:
     13        (KJS::exponentialPartToString):
     14
    1152008-07-02  Kevin McCullough  <[email protected]>
    216
  • trunk/JavaScriptCore/kjs/NumberPrototype.cpp

    r34904 r34961  
    290290{
    291291    buf[i++] = 'e';
    292     buf[i++] = (decimalPoint >= 0) ? '+' : '-';
    293292    // decimalPoint can't be more than 3 digits decimal given the
    294293    // nature of float representation
    295294    int exponential = decimalPoint - 1;
     295    buf[i++] = (exponential >= 0) ? '+' : '-';
    296296    if (exponential < 0)
    297297        exponential *= -1;
Note: See TracChangeset for help on using the changeset viewer.