OLD | NEW |
| (Empty) |
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 | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 // Dart core library. | |
6 | |
7 interface num extends Comparable, Hashable { | |
8 // Arithmetic operations. | |
9 num operator +(num other); | |
10 num operator -(num other); | |
11 num operator *(num other); | |
12 num operator %(num other); | |
13 num operator /(num other); | |
14 // Truncating division. | |
15 num operator ~/(num other); | |
16 // The unary '-' operator. | |
17 num operator negate(); | |
18 num remainder(num other); | |
19 | |
20 // Relational operations. | |
21 bool operator <(num other); | |
22 bool operator <=(num other); | |
23 bool operator >(num other); | |
24 bool operator >=(num other); | |
25 | |
26 // TODO(jimhug): Cheap trick... | |
27 bool operator ==(var other); | |
28 | |
29 | |
30 // Predicates. | |
31 bool isEven(); | |
32 bool isOdd(); | |
33 bool isNaN(); | |
34 bool isNegative(); | |
35 bool isInfinite(); | |
36 | |
37 num abs(); | |
38 num round(); | |
39 num floor(); | |
40 num ceil(); | |
41 num truncate(); | |
42 | |
43 int toInt(); | |
44 double toDouble(); | |
45 | |
46 String toStringAsFixed(int fractionDigits); | |
47 String toStringAsExponential(int fractionDigits); | |
48 String toStringAsPrecision(int precision); | |
49 String toRadixString(int radix); | |
50 | |
51 // TODO(jmesserly): we need to do something in the Frog type system to know | |
52 // to know that most int operations are closed over integers. | |
53 | |
54 // TODO(jimhug): Bit-operations stolen from int | |
55 int operator &(int other); | |
56 int operator |(int other); | |
57 int operator ^(int other); | |
58 int operator ~(); | |
59 int operator <<(int shiftAmount); | |
60 int operator >>(int shiftAmount); | |
61 } | |
OLD | NEW |