Changeset 15155 in webkit for trunk/JavaScriptCore/wtf


Ignore:
Timestamp:
Jul 4, 2006, 9:13:32 PM (19 years ago)
Author:
darin
Message:

Reviewed by Maciej.
Tweaked a bit by Darin.

  • wtf/MathExtras.h: Added include of <float.h>. (isinf): Fix to return false for NAN. (wtf_fmod): Added. An inline that works around the bug.
  • kjs/nodes.cpp:
  • kjs/number_object.cpp:
  • kjs/operations.cpp:
  • kjs/value.cpp: Added includes of MathExtras.h to all files using fmod.
  • JavaScriptCore.xcodeproj/project.pbxproj: Let Xcode 2.3 have its way with the project.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/wtf/MathExtras.h

    r14728 r15155  
    3030#include <xmath.h>
    3131
    32 inline bool isinf(double num) { return !_finite(num); }
     32#if HAVE(FLOAT_H)
     33#include <float.h>
     34#endif
     35
     36inline bool isinf(double num) { return !_finite(num) && !_isnan(num); }
    3337inline bool isnan(double num) { return _isnan(num); }
    3438inline long lround(double num) { return num > 0 ? num + 0.5 : ceil(num - 0.5); }
     
    3842inline bool signbit(double num) { return _copysign(1.0, num) < 0; }
    3943
     44#if PLATFORM(WIN) && COMPILER(MSVC)
     45
     46// Work around a bug in the Microsoft CRT, where fmod(x, +-infinity) yields NaN instead of x.
     47inline double wtf_fmod(double x, double y) { return (!isinf(x) && isinf(y)) ? x : fmod(x, y); }
     48
     49#define fmod(x, y) wtf_fmod(x, y)
     50
    4051#endif
Note: See TracChangeset for help on using the changeset viewer.