Index: runtime/lib/bigint.dart |
diff --git a/runtime/lib/bigint.dart b/runtime/lib/bigint.dart |
index 2e659bc76f9b1e8a7962f1db8fe358a39015deb3..3f23ad775596df347ad948095df894d679c1ce1c 100644 |
--- a/runtime/lib/bigint.dart |
+++ b/runtime/lib/bigint.dart |
@@ -1558,11 +1558,9 @@ class _Bigint extends _IntegerImplementation implements int { |
throw new UnsupportedError("Not coprime"); |
} |
} else { |
- if (x_used == 0) { |
- throw new ArgumentError.value(0, "first operand", "must not be zero"); |
- } |
- if (y_used == 0) { |
- throw new ArgumentError.value(0, "second operand", "must not be zero"); |
+ if ((x_used == 0) && (y_used == 0)) { |
+ throw new ArgumentError.value(0, null, |
+ "at least one operand must not be zero"); |
floitsch
2015/06/24 12:18:13
Wolfram Alpha goes as far as to say that gcd(0, 0)
Lasse Reichstein Nielsen
2015/06/24 12:44:10
It's a usable definition, as long as you can expla
|
} |
if (((x_used == 1) && (x_digits[0] == 1)) || |
((y_used == 1) && (y_digits[0] == 1))) return 1; |
@@ -1810,6 +1808,9 @@ class _Bigint extends _IntegerImplementation implements int { |
if (other is! int) { |
throw new ArgumentError.value(other, "other", "not an integer"); |
} |
+ if (other == 0) { |
floitsch
2015/06/24 12:18:13
Are we sure that bigints cannot be 0?
(If yes asse
Lasse Reichstein Nielsen
2015/06/24 12:44:10
They can be 0, at least internally. The `other._to
regis
2015/06/24 16:07:16
Correct. At this point, 'other' has not yet been f
|
+ return this.abs(); |
+ } |
return _binaryGcd(this, other._toBigint(), false); |
} |
} |