OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 hashCode() { | 8 int hashCode() { |
9 try { | 9 try { |
10 return toInt(); | 10 return toInt(); |
11 } catch (FormatException e) { | 11 } on FormatException catch (e) { |
12 return 0; | 12 return 0; |
13 } | 13 } |
14 } | 14 } |
15 double operator +(num other) { | 15 double operator +(num other) { |
16 return add_(other.toDouble()); | 16 return add_(other.toDouble()); |
17 } | 17 } |
18 double add_(double other) native "Double_add"; | 18 double add_(double other) native "Double_add"; |
19 | 19 |
20 double operator -(num other) { | 20 double operator -(num other) { |
21 return sub_(other.toDouble()); | 21 return sub_(other.toDouble()); |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 return EQUAL; | 222 return EQUAL; |
223 } | 223 } |
224 } else if (isNaN()) { | 224 } else if (isNaN()) { |
225 return other.isNaN() ? EQUAL : GREATER; | 225 return other.isNaN() ? EQUAL : GREATER; |
226 } else { | 226 } else { |
227 // Other is NaN. | 227 // Other is NaN. |
228 return LESS; | 228 return LESS; |
229 } | 229 } |
230 } | 230 } |
231 } | 231 } |
OLD | NEW |