Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 // VMOptions=--optimization-counter-threshold=10 | |
|
zra
2014/04/03 17:04:46
Maybe also add a loop to ensure that this is being
srdjan
2014/04/03 19:33:18
Done.
| |
| 4 | 5 |
| 5 library math_test; | 6 library math_test; |
| 6 import "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
| 7 import 'dart:math'; | 8 import 'dart:math'; |
| 8 | 9 |
| 9 void checkVeryClose(double a, double b) { | 10 void checkVeryClose(double a, double b) { |
| 10 // We find a ulp (unit in the last place) by shifting the original number | 11 // We find a ulp (unit in the last place) by shifting the original number |
| 11 // to the right. This only works if we are not too close to infinity or if | 12 // to the right. This only works if we are not too close to infinity or if |
| 12 // we work with denormals. | 13 // we work with denormals. |
| 13 // We special case or 0.0, but not for infinity. | 14 // We special case or 0.0, but not for infinity. |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 149 // Underflow. | 150 // Underflow. |
| 150 Expect.identical(0.0, pow(10.0, -325.0)); | 151 Expect.identical(0.0, pow(10.0, -325.0)); |
| 151 | 152 |
| 152 // Conversion to double. | 153 // Conversion to double. |
| 153 | 154 |
| 154 // The second argument is an odd integer as int, but not when converted | 155 // The second argument is an odd integer as int, but not when converted |
| 155 // to double. | 156 // to double. |
| 156 Expect.identical(Infinity, pow(-0.0, -9223372036854775809)); | 157 Expect.identical(Infinity, pow(-0.0, -9223372036854775809)); |
| 157 } | 158 } |
| 158 | 159 |
| OLD | NEW |