Chromium Code Reviews| 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 double operator /(num other); | 13 double 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 // Predicates. | 26 // Predicates. |
| 27 bool isEven(); | |
| 28 bool isOdd(); | |
| 29 bool isNaN(); | 27 bool isNaN(); |
|
cshapiro
2011/11/18 21:14:06
As an aside, these would seem to belong in the dou
srdjan
2011/11/18 22:42:34
As I understand it, this is a problem of num being
| |
| 30 bool isNegative(); | 28 bool isNegative(); |
| 31 bool isInfinite(); | 29 bool isInfinite(); |
| 32 | 30 |
| 33 num abs(); | 31 num abs(); |
| 34 num round(); | 32 num round(); |
| 35 num floor(); | 33 num floor(); |
| 36 num ceil(); | 34 num ceil(); |
| 37 num truncate(); | 35 num truncate(); |
| 38 | 36 |
| 39 int toInt(); | 37 int toInt(); |
| 40 double toDouble(); | 38 double toDouble(); |
| 41 | 39 |
| 42 String toStringAsFixed(int fractionDigits); | 40 String toStringAsFixed(int fractionDigits); |
| 43 String toStringAsExponential(int fractionDigits); | 41 String toStringAsExponential(int fractionDigits); |
| 44 String toStringAsPrecision(int precision); | 42 String toStringAsPrecision(int precision); |
| 45 String toRadixString(int radix); | 43 String toRadixString(int radix); |
| 46 } | 44 } |
| OLD | NEW |