Ignore:
Timestamp:
Apr 17, 2009, 12:34:25 AM (16 years ago)
Author:
[email protected]
Message:

Bug 25027: JavaScript parseInt wrong on negative numbers
<https://bugs.webkit.org/show_bug.cgi?id=25027>

Contributed by Mihnea Ovidenie
Reviewed by Oliver Hunt

When dealing with negative numbers, parseInt should use ceil instead of floor.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp

    r40133 r42607  
    304304        double d = value.uncheckedGetNumber();
    305305        if (isfinite(d))
    306             return jsNumber(exec, floor(d));
     306            return jsNumber(exec, (d > 0) ? floor(d) : ceil(d));
    307307        if (isnan(d) || isinf(d))
    308308            return jsNaN(&exec->globalData());
Note: See TracChangeset for help on using the changeset viewer.