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 // Dart core library. | 5 // Dart core library. |
6 | 6 |
7 interface num extends Comparable, Hashable { | 7 interface num extends Comparable, Hashable { |
8 // Arithmetic operations. | 8 // Arithmetic operations. |
9 num operator +(num other); | 9 num operator +(num other); |
10 num operator -(num other); | 10 num operator -(num other); |
11 num operator *(num other); | 11 num operator *(num other); |
12 num operator %(num other); | 12 num operator %(num other); |
13 num operator /(num other); | 13 num operator /(num other); |
14 // Truncating division. | 14 // Truncating division. |
15 num operator ~/(num other); | 15 num operator ~/(num other); |
16 // The unary '-' operator. | 16 // The unary '-' operator. |
17 num operator negate(); | 17 num operator negate(); |
18 num remainder(num other); | 18 num remainder(num other); |
19 | 19 |
20 // Relational operations. | 20 // Relational operations. |
21 bool operator <(num other); | 21 bool operator <(num other); |
22 bool operator <=(num other); | 22 bool operator <=(num other); |
23 bool operator >(num other); | 23 bool operator >(num other); |
24 bool operator >=(num other); | 24 bool operator >=(num other); |
25 | 25 |
| 26 // TODO(jimhug): Cheap trick... |
| 27 bool operator ==(var other); |
| 28 |
| 29 |
26 // Predicates. | 30 // Predicates. |
27 bool isEven(); | 31 bool isEven(); |
28 bool isOdd(); | 32 bool isOdd(); |
29 bool isNaN(); | 33 bool isNaN(); |
30 bool isNegative(); | 34 bool isNegative(); |
31 bool isInfinite(); | 35 bool isInfinite(); |
32 | 36 |
33 num abs(); | 37 num abs(); |
34 num round(); | 38 num round(); |
35 num floor(); | 39 num floor(); |
(...skipping 12 matching lines...) Expand all Loading... |
48 // to know that most int operations are closed over integers. | 52 // to know that most int operations are closed over integers. |
49 | 53 |
50 // TODO(jimhug): Bit-operations stolen from int | 54 // TODO(jimhug): Bit-operations stolen from int |
51 int operator &(int other); | 55 int operator &(int other); |
52 int operator |(int other); | 56 int operator |(int other); |
53 int operator ^(int other); | 57 int operator ^(int other); |
54 int operator ~(); | 58 int operator ~(); |
55 int operator <<(int shiftAmount); | 59 int operator <<(int shiftAmount); |
56 int operator >>(int shiftAmount); | 60 int operator >>(int shiftAmount); |
57 } | 61 } |
OLD | NEW |