| 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 | 8 |
| 9 Type get runtimeType => double; | 9 Type get runtimeType => double; |
| 10 | 10 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 } | 89 } |
| 90 double _remainderFromInteger(int other) { | 90 double _remainderFromInteger(int other) { |
| 91 return new _Double.fromInteger(other).remainder(this); | 91 return new _Double.fromInteger(other).remainder(this); |
| 92 } | 92 } |
| 93 bool _greaterThanFromInteger(int other) | 93 bool _greaterThanFromInteger(int other) |
| 94 native "Double_greaterThanFromInteger"; | 94 native "Double_greaterThanFromInteger"; |
| 95 | 95 |
| 96 bool get isNegative native "Double_getIsNegative"; | 96 bool get isNegative native "Double_getIsNegative"; |
| 97 bool get isInfinite native "Double_getIsInfinite"; | 97 bool get isInfinite native "Double_getIsInfinite"; |
| 98 bool get isNaN native "Double_getIsNaN"; | 98 bool get isNaN native "Double_getIsNaN"; |
| 99 bool get isFinite => !isInfinite && !isNaN; // Can be optimized. |
| 99 | 100 |
| 100 double abs() { | 101 double abs() { |
| 101 // Handle negative 0.0. | 102 // Handle negative 0.0. |
| 102 if (this == 0.0) return 0.0; | 103 if (this == 0.0) return 0.0; |
| 103 return this < 0.0 ? -this : this; | 104 return this < 0.0 ? -this : this; |
| 104 } | 105 } |
| 105 | 106 |
| 106 int round() => roundToDouble().toInt(); | 107 int round() => roundToDouble().toInt(); |
| 107 int floor() => floorToDouble().toInt(); | 108 int floor() => floorToDouble().toInt(); |
| 108 int ceil () => ceilToDouble().toInt(); | 109 int ceil () => ceilToDouble().toInt(); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 return EQUAL; | 230 return EQUAL; |
| 230 } | 231 } |
| 231 } else if (isNaN) { | 232 } else if (isNaN) { |
| 232 return other.isNaN ? EQUAL : GREATER; | 233 return other.isNaN ? EQUAL : GREATER; |
| 233 } else { | 234 } else { |
| 234 // Other is NaN. | 235 // Other is NaN. |
| 235 return LESS; | 236 return LESS; |
| 236 } | 237 } |
| 237 } | 238 } |
| 238 } | 239 } |
| OLD | NEW |