Changeset 17091 in webkit for trunk/JavaScriptCore/wtf
- Timestamp:
- Oct 17, 2006, 2:46:36 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/wtf/MathExtras.h
r16487 r17091 24 24 */ 25 25 26 #ifndef MATH_EXTRAS_H_ 27 #define MATH_EXTRAS_H_ 28 26 29 #include <math.h> 27 30 28 31 #if PLATFORM(WIN) 29 32 33 #include "kjs/operations.h" 34 #include "kjs/value.h" 30 35 #include <xmath.h> 36 #include <limits> 31 37 32 38 #if HAVE(FLOAT_H) … … 48 54 inline int isfinite(double x) { return _finite(x); } 49 55 56 #ifndef M_PI 57 #define M_PI 3.14159265358979323846 58 #endif // M_PI 59 60 #ifndef M_PI_4 61 #define M_PI_4 0.785398163397448309616 62 #endif // M_PI_4 63 64 // Work around a bug in Win, where atan2(+-infinity, +-infinity) yields NaN instead of specific values. 65 inline double wtf_atan2(double x, double y) 66 { 67 static double posInf = std::numeric_limits<double>::infinity(); 68 static double negInf = -std::numeric_limits<double>::infinity(); 69 70 double result = KJS::NaN; 71 72 if (x == posInf && y == posInf) 73 result = M_PI_4; 74 else if (x == posInf && y == negInf) 75 result = 3 * M_PI_4; 76 else if (x == negInf && y == posInf) 77 result = -M_PI_4; 78 else if (x == negInf && y == negInf) 79 result = -3 * M_PI_4; 80 else 81 result = ::atan2(x, y); 82 83 return result; 84 } 85 50 86 #if COMPILER(MSVC) 51 87 … … 55 91 #define fmod(x, y) wtf_fmod(x, y) 56 92 57 #endif 93 #endif // #if COMPILER(MSVC) 58 94 59 #endif 95 #define atan2(x, y) wtf_atan2(x, y) 96 97 #endif // #if PLATFORM(WIN) 98 99 #endif // #ifndef MATH_EXTRAS_H_
Note:
See TracChangeset
for help on using the changeset viewer.