Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(124)

Unified Diff: lib/core/num.dart

Issue 10961013: Add minimal documentation to the num class. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments. Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/core/num.dart
diff --git a/lib/core/num.dart b/lib/core/num.dart
index f8d5842f8856d4c60e3e74e9c9ab1944fc7339ad..3036560255f264b3dcf7431b45f753e70c98c926 100644
--- a/lib/core/num.dart
+++ b/lib/core/num.dart
@@ -5,40 +5,104 @@
// Dart core library.
abstract class num implements Comparable, Hashable {
- // Arithmetic operations.
+ /** Addition operator. */
num operator +(num other);
+
+ /** 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.
+
+ /** Negate operator. */
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.
bool isNaN();
+
bool isNegative();
+
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].
+ *
+ * If the number is not representable as a [double], an
+ * approximation is returned. For numerically large integers, the
+ * approximation may be infinite.
+ */
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);
/**
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698