| 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" | 8 #include "platform/floating_point_win.h" |
| 9 | 9 |
| 10 #include <limits> // NOLINT | 10 #include <limits> // NOLINT |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 double atan2_ieee(double x, double y) { | 31 double atan2_ieee(double x, double y) { |
| 32 int cls_x = _fpclass(x); | 32 int cls_x = _fpclass(x); |
| 33 int cls_y = _fpclass(y); | 33 int cls_y = _fpclass(y); |
| 34 if (((cls_x & (_FPCLASS_PINF | _FPCLASS_NINF)) != 0) && | 34 if (((cls_x & (_FPCLASS_PINF | _FPCLASS_NINF)) != 0) && |
| 35 ((cls_y & (_FPCLASS_PINF | _FPCLASS_NINF)) != 0)) { | 35 ((cls_y & (_FPCLASS_PINF | _FPCLASS_NINF)) != 0)) { |
| 36 // atan2 values at infinities listed above are the same as values | 36 // atan2 values at infinities listed above are the same as values |
| 37 // at (+/-1, +/-1). index_x is 0, when x is +infinty, 1 when x is -infinty. | 37 // at (+/-1, +/-1). index_x is 0, when x is +infinty, 1 when x is -infinty. |
| 38 // Same is with index_y. | 38 // Same is with index_y. |
| 39 int index_x = (cls_x & _FPCLASS_PINF) != 0 ? 0 : 1; | 39 int index_x = (cls_x & _FPCLASS_PINF) != 0 ? 0 : 1; |
| 40 int index_y = (cls_y & _FPCLASS_PINF) != 0 ? 0 : 1; | 40 int index_y = (cls_y & _FPCLASS_PINF) != 0 ? 0 : 1; |
| 41 static double atans_at_infinities[2][2] = | 41 static double atans_at_infinities[2][2] = { |
| 42 { { atan2(1., 1.), atan2(1., -1.) }, | 42 {atan2(1., 1.), atan2(1., -1.)}, {atan2(-1., 1.), atan2(-1., -1.)}}; |
| 43 { atan2(-1., 1.), atan2(-1., -1.) } }; | |
| 44 return atans_at_infinities[index_x][index_y]; | 43 return atans_at_infinities[index_x][index_y]; |
| 45 } else { | 44 } else { |
| 46 return atan2(x, y); | 45 return atan2(x, y); |
| 47 } | 46 } |
| 48 } | 47 } |
| 49 | 48 |
| 50 #endif // defined(TARGET_OS_WINDOWS) | 49 #endif // defined(TARGET_OS_WINDOWS) |
| OLD | NEW |