| 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 class _Double implements double { | 5 class _Double implements double { |
| 6 factory _Double.fromInteger(int value) | 6 factory _Double.fromInteger(int value) |
| 7 native "Double_doubleFromInteger"; | 7 native "Double_doubleFromInteger"; |
| 8 int get hashCode { | 8 int get hashCode { |
| 9 try { | 9 try { |
| 10 return toInt(); | 10 return toInt(); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 double floor() native "Double_floor"; | 107 double floor() native "Double_floor"; |
| 108 double ceil () native "Double_ceil"; | 108 double ceil () native "Double_ceil"; |
| 109 double truncate() native "Double_truncate"; | 109 double truncate() native "Double_truncate"; |
| 110 int toInt() native "Double_toInt"; | 110 int toInt() native "Double_toInt"; |
| 111 double toDouble() { return this; } | 111 double toDouble() { return this; } |
| 112 | 112 |
| 113 double pow(num exponent) { | 113 double pow(num exponent) { |
| 114 if (exponent == 0) { | 114 if (exponent == 0) { |
| 115 return 1.0; // ECMA-262 15.8.2.13 | 115 return 1.0; // ECMA-262 15.8.2.13 |
| 116 } | 116 } |
| 117 if (exponent is! num) { | 117 // Throw NullPointerException if exponent is null. |
| 118 throw new ArgumentError(null); | |
| 119 } | |
| 120 double doubleExponent = exponent.toDouble(); | 118 double doubleExponent = exponent.toDouble(); |
| 121 if (isNaN || exponent.isNaN) { | 119 if (isNaN || exponent.isNaN) { |
| 122 return double.NAN; | 120 return double.NAN; |
| 123 } | 121 } |
| 124 return _pow(doubleExponent); | 122 return _pow(doubleExponent); |
| 125 } | 123 } |
| 126 double _pow(double exponent) native "Double_pow"; | 124 double _pow(double exponent) native "Double_pow"; |
| 127 | 125 |
| 128 String toStringAsFixed(int fractionDigits) { | 126 String toStringAsFixed(int fractionDigits) { |
| 129 // See ECMAScript-262, 15.7.4.5 for details. | 127 // See ECMAScript-262, 15.7.4.5 for details. |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 return EQUAL; | 221 return EQUAL; |
| 224 } | 222 } |
| 225 } else if (isNaN) { | 223 } else if (isNaN) { |
| 226 return other.isNaN ? EQUAL : GREATER; | 224 return other.isNaN ? EQUAL : GREATER; |
| 227 } else { | 225 } else { |
| 228 // Other is NaN. | 226 // Other is NaN. |
| 229 return LESS; | 227 return LESS; |
| 230 } | 228 } |
| 231 } | 229 } |
| 232 } | 230 } |
| OLD | NEW |