Changeset 26919 in webkit


Ignore:
Timestamp:
Oct 23, 2007 7:12:30 AM (16 years ago)
Author:
darin
Message:

JavaScriptCore:

Reviewed by Maciej.

Test: fast/js/math.html

  • kjs/math_object.cpp: (MathFuncImp::callAsFunction): Fix abs to look at the sign bit. Add a special case for values in the range between -0 and -1 and a special case for ceil and for -0 for floor.

LayoutTests:

Reviewed by Maciej.

  • fast/js/math-expected.txt: Added.
  • fast/js/math.html: Added.
  • fast/js/resources/math.js: Added.
Location:
trunk
Files:
3 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r26914 r26919  
     12007-10-23  Darin Adler  <darin@apple.com>
     2
     3        Reviewed by Maciej.
     4
     5        - fix http://bugs.webkit.org/show_bug.cgi?id=15639
     6          fix Math.abs(0), Math.ceil(-0), and Math.floor(-0)
     7
     8        Test: fast/js/math.html
     9
     10        * kjs/math_object.cpp: (MathFuncImp::callAsFunction):
     11        Fix abs to look at the sign bit. Add a special case for values in the range
     12        between -0 and -1 and a special case for ceil and for -0 for floor.
     13
    1142007-10-23  Darin Adler  <darin@apple.com>
    215
  • trunk/JavaScriptCore/kjs/math_object.cpp

    r26688 r26919  
    134134  switch (id) {
    135135  case MathObjectImp::Abs:
    136     result = ( arg < 0 || arg == -0) ? (-arg) : arg;
     136    result = signbit(arg) ? -arg : arg;
    137137    break;
    138138  case MathObjectImp::ACos:
     
    149149    break;
    150150  case MathObjectImp::Ceil:
    151     result = ceil(arg);
     151    if (signbit(arg) && arg > -1.0)
     152      result = -0.0;
     153    else
     154      result = ceil(arg);
    152155    break;
    153156  case MathObjectImp::Cos:
     
    158161    break;
    159162  case MathObjectImp::Floor:
    160     result = floor(arg);
     163    if (signbit(arg) && arg == 0.0)
     164      result = -0.0;
     165    else
     166      result = floor(arg);
    161167    break;
    162168  case MathObjectImp::Log:
  • trunk/LayoutTests/ChangeLog

    r26907 r26919  
     12007-10-23  Darin Adler  <darin@apple.com>
     2
     3        Reviewed by Maciej.
     4
     5        - test for http://bugs.webkit.org/show_bug.cgi?id=15639
     6          Math functions
     7
     8        * fast/js/math-expected.txt: Added.
     9        * fast/js/math.html: Added.
     10        * fast/js/resources/math.js: Added.
     11
    1122007-10-22  Eric Seidel  <eric@webkit.org>
    213
Note: See TracChangeset for help on using the changeset viewer.