OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "platform/globals.h" | 5 #include "platform/globals.h" |
6 #if defined(TARGET_OS_WINDOWS) | 6 #if defined(TARGET_OS_WINDOWS) |
7 | 7 |
| 8 #include "platform/floating_point_win.h" |
| 9 |
8 #include <limits> // NOLINT | 10 #include <limits> // NOLINT |
9 | 11 |
10 // Taken from third_party/v8/src/platform-win32.cc | 12 // Taken from third_party/v8/src/platform-win32.cc |
11 double fmod_ieee(double x, double y) { | 13 double fmod_ieee(double x, double y) { |
12 // x is dividend, y is divisor. | 14 // x is dividend, y is divisor. |
13 // Work around MS fmod bugs. ISO Standard says: | 15 // Work around MS fmod bugs. ISO Standard says: |
14 // If dividend is finite and divisor is an infinity or | 16 // If dividend is finite and divisor is an infinity or |
15 // dividend is a zero and divisor is nonzero finite, | 17 // dividend is a zero and divisor is nonzero finite, |
16 // then dividend is returned. | 18 // then dividend is returned. |
17 if (!(_finite(x) && (!_finite(y) && !isnan(y))) && | 19 if (!(_finite(x) && (!_finite(y) && !isnan(y))) && |
(...skipping 21 matching lines...) Expand all Loading... |
39 static double atans_at_infinities[2][2] = | 41 static double atans_at_infinities[2][2] = |
40 { { atan2(1., 1.), atan2(1., -1.) }, | 42 { { atan2(1., 1.), atan2(1., -1.) }, |
41 { atan2(-1., 1.), atan2(-1., -1.) } }; | 43 { atan2(-1., 1.), atan2(-1., -1.) } }; |
42 return atans_at_infinities[index_x][index_y]; | 44 return atans_at_infinities[index_x][index_y]; |
43 } else { | 45 } else { |
44 return atan2(x, y); | 46 return atan2(x, y); |
45 } | 47 } |
46 } | 48 } |
47 | 49 |
48 #endif // defined(TARGET_OS_WINDOWS) | 50 #endif // defined(TARGET_OS_WINDOWS) |
OLD | NEW |