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

Unified Diff: sdk/lib/core/int.dart

Issue 1211473002: Make int.gcd accept zero operands. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Address comment. Created 5 years, 5 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 | « sdk/lib/_internal/js_runtime/lib/js_number.dart ('k') | tests/corelib/big_integer_arith_vm_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/core/int.dart
diff --git a/sdk/lib/core/int.dart b/sdk/lib/core/int.dart
index 72c5bcfe39215a2b7441d9c16e67817f9a14ca64..98f7da82da4bee10ca125d6a021837a91f525a3e 100644
--- a/sdk/lib/core/int.dart
+++ b/sdk/lib/core/int.dart
@@ -122,10 +122,17 @@ abstract class int extends num {
int modInverse(int modulus);
/**
- * Returns the greatest common divisor of the absolute value of
- * this integer and the absolute value of [other].
+ * Returns the greatest common divisor of this integer and [other].
*
- * Both this and [other] must be non-zero.
+ * If either number is non-zero, the result is the numerically greatest
+ * integer dividing both `this` and `other`.
+ *
+ * The greatest common divisor is independent of the order,
+ * so `x.gcd(y)` is always the same as `y.gcd(x)`.
+ *
+ * For any integer `x`, `x.gcd(x)` is `x.abs()`.
+ *
+ * If both `this` and `other` is zero, the result is also zero.
*/
int gcd(int other);
« no previous file with comments | « sdk/lib/_internal/js_runtime/lib/js_number.dart ('k') | tests/corelib/big_integer_arith_vm_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698