From 0be68cd7d2dc7a67fca0334e676ae23c57024a93 Mon Sep 17 00:00:00 2001 From: Iaroslav Date: Wed, 29 Jul 2020 15:48:53 +0700 Subject: [PATCH] Make JBigIntegerField implement Ring and RemainderDivisionOperations instead of Field --- .../jvmMain/kotlin/scientifik/kmath/operations/BigNumbers.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kmath-core/src/jvmMain/kotlin/scientifik/kmath/operations/BigNumbers.kt b/kmath-core/src/jvmMain/kotlin/scientifik/kmath/operations/BigNumbers.kt index eb268bb5e..a0c9c9202 100644 --- a/kmath-core/src/jvmMain/kotlin/scientifik/kmath/operations/BigNumbers.kt +++ b/kmath-core/src/jvmMain/kotlin/scientifik/kmath/operations/BigNumbers.kt @@ -7,7 +7,7 @@ import java.math.MathContext /** * A field wrapper for Java [BigInteger] */ -object JBigIntegerField : Field { +object JBigIntegerField : Ring, RemainderDivisionOperations { override val zero: BigInteger get() = BigInteger.ZERO @@ -15,12 +15,13 @@ object JBigIntegerField : Field { get() = BigInteger.ONE override fun number(value: Number): BigInteger = BigInteger.valueOf(value.toLong()) - override fun divide(a: BigInteger, b: BigInteger): BigInteger = a.div(b) override fun add(a: BigInteger, b: BigInteger): BigInteger = a.add(b) override fun BigInteger.minus(b: BigInteger): BigInteger = this.subtract(b) override fun multiply(a: BigInteger, k: Number): BigInteger = a.multiply(k.toInt().toBigInteger()) override fun multiply(a: BigInteger, b: BigInteger): BigInteger = a.multiply(b) override fun BigInteger.unaryMinus(): BigInteger = negate() + override infix fun BigInteger.div(arg: BigInteger): BigInteger = this.divide(arg) + override infix fun BigInteger.rem(arg: BigInteger): BigInteger = remainder(arg) } /**