added extensions for BigInteger and BigDecimal

This commit is contained in:
svtk
2012-01-30 14:55:31 +04:00
parent 1d71e820bb
commit 4ce9a89d85
5 changed files with 73 additions and 5 deletions
+27
View File
@@ -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()