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

Unified Diff: lib/core/int.dart

Issue 10959067: Add documentation of double and int. (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
Index: lib/core/int.dart
diff --git a/lib/core/int.dart b/lib/core/int.dart
index 0855a62b6346bc89cb0e7dedec350eb5107e8f22..31bde855e57494d4eb89be6c2096d22b9fc7a3d4 100644
--- a/lib/core/int.dart
+++ b/lib/core/int.dart
@@ -1,34 +1,69 @@
-// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// Dart core library.
-
+/**
+ * Representation of Dart integers containing integer specific
+ * operations and specialization of operations inherited from [num].
+ *
+ * Integers can be arbitrarily large in Dart.
+ *
+ * *Note however, that when compiling to JavaScript, integers are
+ * implemented as JavaScript numbers. When compiling to JavaScript,
+ * integers are therefore restricted to 53 significant bits because
+ * all JavaScript numbers are double-precision floating point
+ * values. The behavior of the operators and methods in the [int]
+ * class therefore sometimes differs between the Dart VM and Dart code
+ * compiled to JavaScript.*
+ */
abstract class int implements num {
- // Bit-operations.
+ /** The bit-wise and operator. */
int operator &(int other);
+
+ /** The bit-wise or operator. */
int operator |(int other);
+
+ /** The bit-wise xor operator. */
int operator ^(int other);
+
+ /** The bit-wise negate operator. */
int operator ~();
+
+ /** The left shift operator. */
int operator <<(int shiftAmount);
+
+ /** The right shift operator. */
int operator >>(int shiftAmount);
- // Testers.
+ /** Returns true if and only if this integer is even. */
bool isEven();
+
+ /** Returns true if and only if this integer is odd. */
bool isOdd();
- // Specializations of super-interface.
+ /** Negate operator. Negating an integer produces an integer. */
int operator -();
+
+ /** Returns the absolute value of this integer. */
int abs();
+
+ /** For integers the round method is the identify function. */
int round();
+
+ /** For integers the floor method is the identify function. */
int floor();
+
+ /** For integers the ceil method is the identify function. */
int ceil();
+
+ /** For integers the truncate method is the identify function. */
int truncate();
+
/**
* Returns a representation of this [int] value.
*
- * It should always be the case that if 'i' is an [int] value, then
- * [:i == int.parse(i.toString())].
+ * It should always be the case that if [:i:] is an [int] value,
+ * then [:i == int.parse(i.toString()):].
*/
String toString();
@@ -37,6 +72,7 @@ abstract class int implements num {
*
* Accepts "0x" prefix for hexadecimal numbers, otherwise defaults
* to base-10.
+ *
* Throws a [FormatException] if [source] is not a valid integer literal.
*/
external static int parse(String source);
« lib/core/double.dart ('K') | « lib/core/double.dart ('k') | lib/core/num.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698