Ignore:
Timestamp:
Oct 17, 2006, 2:46:36 PM (19 years ago)
Author:
kmccullo
Message:

Reviewed by Brady.

Fixes a JavaScriptCore math issue on win.

  • kjs/math_object.cpp: (MathFuncImp::callAsFunction):
  • wtf/MathExtras.h: (wtf_atan2):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/math_object.cpp

    r17073 r17091  
    2323#include "math_object.h"
    2424#include "math_object.lut.h"
     25#include "wtf/MathExtras.h"
    2526
    2627#include "operations.h"
    2728#include <math.h>
    2829#include <time.h>
    29 
    30 #if PLATFORM(WIN_OS)
    31 
    32 #include <float.h>
    33 static int signbit(double d)
    34 {
    35     // FIXME: Not sure if this is exactly right.
    36     switch (_fpclass(d)) {
    37         case _FPCLASS_NINF:
    38         case _FPCLASS_NN:
    39         case _FPCLASS_ND:
    40         case _FPCLASS_NZ:
    41             // It's one of wacky negatives, report as negative.
    42             return 1;
    43         case _FPCLASS_PINF:
    44         case _FPCLASS_PN:
    45         case _FPCLASS_PD:
    46         case _FPCLASS_PZ:
    47             // It's one of wacky positives, report as positive.
    48             return 0;
    49         default:
    50             return d < 0;
    51     }
    52 }
    53 
    54 #endif
    55 
    56 #ifndef M_PI
    57 #define M_PI 3.14159265358979323846
    58 #endif  /*  M_PI  */
    5930
    6031using namespace KJS;
     
    227198    else if (isNaN(arg) && arg2 != 0)
    228199      result = NaN;
    229     else if (fabs(arg) == 1 && KJS::isInf(arg2))
     200    else if (fabs(arg) == 1 && isInf(arg2))
    230201      result = NaN;
     202    else if (arg2 == 0 && arg != 0)
     203      result = 1;
    231204    else
    232       result = pow(arg, arg2);
     205      result = ::pow(arg, arg2);
    233206    break;
    234207  case MathObjectImp::Random:
Note: See TracChangeset for help on using the changeset viewer.