added extensions for BigInteger and BigDecimal
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package std.math
|
||||
|
||||
import java.math.BigInteger
|
||||
import java.math.BigDecimal
|
||||
|
||||
fun BigInteger.plus(other: BigInteger) = this.add(other).sure()
|
||||
|
||||
fun BigInteger.minus(other: BigInteger) = this.subtract(other).sure()
|
||||
|
||||
fun BigInteger.times(other: BigInteger) = this.multiply(other).sure()
|
||||
|
||||
fun BigInteger.div(other: BigInteger) = this.divide(other).sure()
|
||||
|
||||
fun BigInteger.minus() = this.negate().sure()
|
||||
|
||||
|
||||
fun BigDecimal.plus(other: BigDecimal) = this.add(other).sure()
|
||||
|
||||
fun BigDecimal.minus(other: BigDecimal) = this.subtract(other).sure()
|
||||
|
||||
fun BigDecimal.times(other: BigDecimal) = this.multiply(other).sure()
|
||||
|
||||
fun BigDecimal.div(other: BigDecimal) = this.divide(other).sure()
|
||||
|
||||
fun BigDecimal.mod(other: BigDecimal) = this.remainder(other).sure()
|
||||
|
||||
fun BigDecimal.minus() = this.negate().sure()
|
||||
Reference in New Issue
Block a user