Chromium Code Reviews| Index: lib/core/num.dart |
| diff --git a/lib/core/num.dart b/lib/core/num.dart |
| index f8d5842f8856d4c60e3e74e9c9ab1944fc7339ad..c172c5fdf00afb9c2767d5ca9c50268b9e3fb975 100644 |
| --- a/lib/core/num.dart |
| +++ b/lib/core/num.dart |
| @@ -5,51 +5,85 @@ |
| // Dart core library. |
| abstract class num implements Comparable, Hashable { |
| - // Arithmetic operations. |
| + /// Addition operator. |
|
Lasse Reichstein Nielsen
2012/09/20 12:49:38
Why the /// comments now? We don't do that anywher
Mads Ager (google)
2012/09/20 13:36:08
No particular reason. I think the comment style is
|
| num operator +(num other); |
|
Lasse Reichstein Nielsen
2012/09/20 12:49:38
empty line after declarations (except the last in
Mads Ager (google)
2012/09/20 13:36:08
Done.
|
| + /// Subtraction operator. |
| num operator -(num other); |
| + /// Multiplication operator. |
| num operator *(num other); |
| + /// Euclidean modulo operator. |
| num operator %(num other); |
| + /// Division operator. |
| double operator /(num other); |
| - // Truncating division. |
| + /// Truncating division operator. |
| + /// |
| + /// The result of the truncating division [:a ~/ b:] is equivalent to |
| + /// [:(a / b).truncate():]. |
| num operator ~/(num other); |
| - // The unary '-' operator. |
| + /// Unary minus operator. |
|
Lasse Reichstein Nielsen
2012/09/20 12:49:38
That's the negate operator.
Mads Ager (google)
2012/09/20 13:36:08
Done.
|
| num operator -(); |
| + |
| + /// Return the remainder from dividing this [num] by [other]. |
| num remainder(num other); |
| - // Relational operations. |
| + /// Relational less than operator. |
| bool operator <(num other); |
| + /// Relational less than or equal operator. |
| bool operator <=(num other); |
| + /// Relational greater than operator. |
| bool operator >(num other); |
| + /// Relational greater than or equal operator. |
| bool operator >=(num other); |
| - // Predicates. |
| + /// isNan predicate. |
|
Lasse Reichstein Nielsen
2012/09/20 12:49:38
I'd rather be without this comment. It says nothin
Mads Ager (google)
2012/09/20 13:36:08
I have removed these comments. However, this poses
Lasse Reichstein Nielsen
2012/09/20 19:45:13
They increase the information (not by a lot, but s
|
| bool isNaN(); |
| + /// isNegative predicate. |
| bool isNegative(); |
| + /// isInfinite predicate. |
| bool isInfinite(); |
| + /// Returns the absolute value of this [num]. |
| num abs(); |
| - num round(); |
| + /// Returns the greatest integer value no greater than this [num]. |
| num floor(); |
| + /// Returns the least integer value that is no smaller than this [num]. |
| num ceil(); |
| + |
| + /// Returns the integer value closest to this [num]. |
| + /// |
| + /// Rounds away from zero when there is no closest integer: |
| + /// [:(3.5).round() == 4:] and [:(-3.5).round() == -4:]. |
| + num round(); |
| + |
| + /// Returns the integer value obtained by discarding any fractional |
| + /// digits from this [num]. |
| num truncate(); |
| + /// Truncates this [num] to an integer and returns the result as an [int]. |
| int toInt(); |
| + |
| + /// Return this [num] as a [double]. |
|
Lasse Reichstein Nielsen
2012/09/20 12:49:38
///
/// If the number is not representable as a [d
Mads Ager (google)
2012/09/20 13:36:08
Done, thanks.
|
| double toDouble(); |
| + /// Converts a [num] to a string representation with [fractionDigits] |
| + /// digits after the decimal point. |
| String toStringAsFixed(int fractionDigits); |
| + |
| + /// Converts a [num] to a string in decimal exponential notation with |
| + /// [fractionDigits] digits after the decimal point. |
| String toStringAsExponential(int fractionDigits); |
| + |
| + /// Converts a [num] to a string representation with [precision] |
| + /// significant digits. |
| String toStringAsPrecision(int precision); |
| - /** |
| - * Converts a [num] to a string representation in the given [radix]. |
| - * |
| - * The [num] in converted to an [int] using [toInt]. That [int] is |
| - * then converted to a string representation with the given |
| - * [radix]. In the string representation, lower-case letters are |
| - * used for digits above '9'. |
| - * |
| - * The [radix] argument must be an integer between 2 and 36. |
| - */ |
| + /// Converts a [num] to a string representation in the given [radix]. |
| + /// |
| + /// The [num] in converted to an [int] using [toInt]. That [int] is |
| + /// then converted to a string representation with the given |
| + /// [radix]. In the string representation, lower-case letters are |
| + /// used for digits above '9'. |
| + /// |
| + /// The [radix] argument must be an integer between 2 and 36. |
| String toRadixString(int radix); |
| } |