| 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 // TODO(srdjan): fix limitations. | 5 // TODO(srdjan): fix limitations. |
| 6 // - shift amount must be a Smi. | 6 // - shift amount must be a Smi. |
| 7 class _IntegerImplementation extends _Num { | 7 class _IntegerImplementation extends _Num { |
| 8 // The Dart class _Bigint extending _IntegerImplementation requires a | 8 // The Dart class _Bigint extending _IntegerImplementation requires a |
| 9 // default constructor. | 9 // default constructor. |
| 10 | 10 |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 } | 193 } |
| 194 if (lowerLimit.isNaN) return lowerLimit; | 194 if (lowerLimit.isNaN) return lowerLimit; |
| 195 // Note that we don't need to care for -0.0 for the lower limit. | 195 // Note that we don't need to care for -0.0 for the lower limit. |
| 196 if (this < lowerLimit) return lowerLimit; | 196 if (this < lowerLimit) return lowerLimit; |
| 197 if (this.compareTo(upperLimit) > 0) return upperLimit; | 197 if (this.compareTo(upperLimit) > 0) return upperLimit; |
| 198 return this; | 198 return this; |
| 199 } | 199 } |
| 200 | 200 |
| 201 int toInt() { return this; } | 201 int toInt() { return this; } |
| 202 double toDouble() { return new _Double.fromInteger(this); } | 202 double toDouble() { return new _Double.fromInteger(this); } |
| 203 _Bigint _toBigint() { return new _Bigint()._setInt(this); } | 203 _Bigint _toBigint() { return new _Bigint._fromInt(this); } |
| 204 num _toBigintOrDouble() { return _toBigint(); } | 204 num _toBigintOrDouble() { return _toBigint(); } |
| 205 | 205 |
| 206 String toStringAsFixed(int fractionDigits) { | 206 String toStringAsFixed(int fractionDigits) { |
| 207 return this.toDouble().toStringAsFixed(fractionDigits); | 207 return this.toDouble().toStringAsFixed(fractionDigits); |
| 208 } | 208 } |
| 209 String toStringAsExponential([int fractionDigits]) { | 209 String toStringAsExponential([int fractionDigits]) { |
| 210 return this.toDouble().toStringAsExponential(fractionDigits); | 210 return this.toDouble().toStringAsExponential(fractionDigits); |
| 211 } | 211 } |
| 212 String toStringAsPrecision(int precision) { | 212 String toStringAsPrecision(int precision) { |
| 213 return this.toDouble().toStringAsPrecision(precision); | 213 return this.toDouble().toStringAsPrecision(precision); |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 // Shift by mint exceeds range that can be handled by the VM. | 503 // Shift by mint exceeds range that can be handled by the VM. |
| 504 int _shrFromInt(int other) { | 504 int _shrFromInt(int other) { |
| 505 if (other < 0) { | 505 if (other < 0) { |
| 506 return -1; | 506 return -1; |
| 507 } else { | 507 } else { |
| 508 return 0; | 508 return 0; |
| 509 } | 509 } |
| 510 } | 510 } |
| 511 int _shlFromInt(int other) native "Mint_shlFromInt"; | 511 int _shlFromInt(int other) native "Mint_shlFromInt"; |
| 512 } | 512 } |
| OLD | NEW |