Revert change of JBigIntegerField to Ring, delete unused psvm function

This commit is contained in:
Iaroslav 2020-06-28 22:10:39 +07:00
parent 415d11749a
commit 1614eef452
No known key found for this signature in database
GPG Key ID: 46E15E4A31B3BCD7

View File

@ -7,13 +7,14 @@ import java.math.MathContext
/** /**
* A field wrapper for Java [BigInteger] * A field wrapper for Java [BigInteger]
*/ */
object JBigIntegerRing : Ring<BigInteger>, PowerOperations<BigInteger> { object JBigIntegerField : Field<BigInteger>, PowerOperations<BigInteger> {
override val zero: BigInteger override val zero: BigInteger
get() = BigInteger.ZERO get() = BigInteger.ZERO
override val one: BigInteger override val one: BigInteger
get() = BigInteger.ONE get() = BigInteger.ONE
override fun divide(a: BigInteger, b: BigInteger): BigInteger = a.div(b)
override fun add(a: BigInteger, b: BigInteger): BigInteger = a.add(b) override fun add(a: BigInteger, b: BigInteger): BigInteger = a.add(b)
override fun BigInteger.minus(b: BigInteger): BigInteger = this.subtract(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, k: Number): BigInteger = a.multiply(k.toInt().toBigInteger())
@ -54,7 +55,3 @@ abstract class JBigDecimalFieldBase internal constructor(val mathContext: MathCo
class JBigDecimalField(mathContext: MathContext = MathContext.DECIMAL64) : JBigDecimalFieldBase(mathContext) { class JBigDecimalField(mathContext: MathContext = MathContext.DECIMAL64) : JBigDecimalFieldBase(mathContext) {
companion object : JBigDecimalFieldBase() companion object : JBigDecimalFieldBase()
} }
fun main() {
JBigDecimalField { one pow 2 }
}