Chromium Code Reviews| Index: runtime/lib/double.dart |
| =================================================================== |
| --- runtime/lib/double.dart (revision 4834) |
| +++ runtime/lib/double.dart (working copy) |
| @@ -112,7 +112,15 @@ |
| double toDouble() { return this; } |
| double pow(num exponent) { |
| - return _pow(exponent.toDouble()); |
| + if (exponent == 0) { |
| + return 1.0; // ECMA-262 15.8.2.13 |
|
ngeoffray
2012/03/02 07:55:47
Wouldn't it be better to point to Dart spec instea
srdjan
2012/03/02 17:55:37
Good point. There is no Dart library spec for "pow
|
| + } |
| + // Throw NullPointerException if exponent is null. |
| + double doubleExponent = exponent.toDouble(); |
| + if (isNaN() || exponent.isNaN()) { |
| + return double.NAN; |
| + } |
| + return _pow(doubleExponent); |
| } |
| double _pow(double exponent) native "Double_pow"; |