| 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 // TODO: Make a stared static method for hashCode and _identityHashCode | 9 // TODO: Make a stared static method for hashCode and _identityHashCode |
| 10 // when semantics are corrected as described in: | 10 // when semantics are corrected as described in: |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 } else { | 268 } else { |
| 269 return EQUAL; | 269 return EQUAL; |
| 270 } | 270 } |
| 271 } else if (isNaN) { | 271 } else if (isNaN) { |
| 272 return other.isNaN ? EQUAL : GREATER; | 272 return other.isNaN ? EQUAL : GREATER; |
| 273 } else { | 273 } else { |
| 274 // Other is NaN. | 274 // Other is NaN. |
| 275 return LESS; | 275 return LESS; |
| 276 } | 276 } |
| 277 } | 277 } |
| 278 | |
| 279 static const int _FRACTIONAL_BITS = // Bits to keep after the decimal point. | |
| 280 const int.fromEnvironment("doubleFractionalBits", defaultValue: 20); | |
| 281 static const double _BIAS = 1.5 * (1 << (52 - _FRACTIONAL_BITS)); | |
| 282 | |
| 283 // Returns this with only _FRACTIONAL_BITS bits after the decimal point. | |
| 284 double get p => this + _BIAS - _BIAS; | |
| 285 } | 278 } |
| OLD | NEW |