Index: runtime/lib/bigint.dart |
diff --git a/runtime/lib/bigint.dart b/runtime/lib/bigint.dart |
index 7e508bff07daa2aedfefcbffc7247e71bcf8e030..a278595175f561f9ca58520a3162aafafb66ebae 100644 |
--- a/runtime/lib/bigint.dart |
+++ b/runtime/lib/bigint.dart |
@@ -1811,11 +1811,14 @@ class _Bigint extends _IntegerImplementation implements int { |
return _binaryGcd(m, t, true); |
} |
- // Returns gcd of abs(this) and abs(other), with this != 0 and other !=0. |
+ // Returns gcd of abs(this) and abs(other). |
int gcd(int other) { |
if (other is! int) { |
throw new ArgumentError.value(other, "other", "not an integer"); |
} |
+ if (other == 0) { |
+ return this.abs(); |
+ } |
return _binaryGcd(this, other._toBigint(), false); |
} |
} |