Index: runtime/lib/integers.dart |
diff --git a/runtime/lib/integers.dart b/runtime/lib/integers.dart |
index f31a453f437920a1f88a633e8647bbc31fe5e295..7685ca60ed18fdb475c92bc04f475cfcc28fb8d0 100644 |
--- a/runtime/lib/integers.dart |
+++ b/runtime/lib/integers.dart |
@@ -391,14 +391,14 @@ class _IntegerImplementation extends _Num { |
if (other is! int) { |
throw new ArgumentError.value(other, "other", "not an integer"); |
} |
- if (this == 0) { |
- throw new ArgumentError.value(this, "first operand", "must not be zero"); |
- } |
- if (other == 0) { |
- throw new ArgumentError.value(this, "second operand", "must not be zero"); |
+ if ((this == 0) && (other == 0)) { |
+ throw new ArgumentError.value(0, null, |
+ "at least one operand must not be zero"); |
} |
int x = this.abs(); |
int y = other.abs(); |
+ if (x == 0) return y; |
+ if (y == 0) return x; |
if ((x == 1) || (y == 1)) return 1; |
if (other is _Bigint) { |
return _toBigint().gcd(other); |