From 3ad7f32ada115b279e00edc49f5e9ba7e63a834d Mon Sep 17 00:00:00 2001 From: zhelenskiy Date: Mon, 10 May 2021 18:41:40 +0300 Subject: [PATCH] Incorrect BigInt equality fixed --- .../kotlin/space/kscience/kmath/operations/BigInt.kt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/BigInt.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/BigInt.kt index e74efa9ca..e81f1686d 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/BigInt.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/BigInt.kt @@ -56,8 +56,7 @@ public class BigInt internal constructor( else -> sign * compareMagnitudes(magnitude, other.magnitude) } - public override fun equals(other: Any?): Boolean = - if (other is BigInt) compareTo(other) == 0 else error("Can't compare KBigInteger to a different type") + public override fun equals(other: Any?): Boolean = other is BigInt && compareTo(other) == 0 public override fun hashCode(): Int = magnitude.hashCode() + sign