kotlin-multiplatform-bignum icon indicating copy to clipboard operation
kotlin-multiplatform-bignum copied to clipboard

A Kotlin multiplatform library for arbitrary precision arithmetics

Results 35 kotlin-multiplatform-bignum issues
Sort by recently updated
recently updated
newest added

**Is your feature request related to a problem? Please describe.** I need to convert a biginteger value to another format to be stored in a database that stores a 128...

enhancement

~~~kt assertEquals("${-15.5 % 360.0}", ((-15.5).bd % 360.bd).toStringExpanded()) ~~~ fails: ~~~ Expected :-15.5 Actual :-0.155 ~~~ - was like this at least on JVM. Full test cor convenience: ~~~kt import com.ionspin.kotlin.bignum.decimal.BigDecimal...

**Describe the bug** Operations like addition or subtraction are loosing the scale when one of the operand value is zero with a scale of zero. **To Reproduce** ```kotlin println((BigDecimal.parseString("1").scale(0) +...

**Describe the bug** Incorrect values for modInverse function **To Reproduce** Steps to reproduce the behavior: ``` @Test fun testModInverse() { val a = BigInteger.parseString("54647") .modInverse(BigInteger.parseString("1157920")) assertEquals( BigInteger.parseString("1141223"), a ) ```...

**Describe the bug** Incorrect values for the "or" function **Issue 1: Incorrect values** **To Reproduce** ``` @Test fun testOr() { val a = BigInteger.parseString("-1") .or(BigInteger.parseString("11")) assertEquals( BigInteger.parseString("-1"), a ) }...

**Describe the bug** The result of BigDecimal.divideAndRemainder are incorrect.: ~~~kotlin @Test fun testRemainder() { val full = BigDecimal.fromInt(360) val x = BigDecimal.fromDouble(15.5) + full*5 val (q,r) = x.divideAndRemainder(full) assertEquals("5", q.toStringExpanded())...

Replacing `== ZERO` by `isZero()` ## Motivation Similar of #301 but for BigInteger. Equals are more costly than testing isZero or isNegative. ## Special case `BigInteger.pow(BigInteger)` uses `exponentiationBySquaring` which is...

- use isZero instead of comparing with BigInteger.ZERO (I forgot this one on the other PRs...) - skip the extendedSignificand when using scale. - > [!Important] > I understand that...

Replacing `== ZERO` by `isZero()` on BigDecimal class. ## Motivation `equals` method calls `BD.compare(BD)` which requires to bring the significant to same exponent before comparing (if either exponent or precision...

Similar PR than previous one but with focus on the BigInteger. ```kotlin @Test fun perfTest() { val bd = BigInteger.parseString("123") val duration = measureTime { repeat(1_000_000) { bd.numberOfDecimalDigits() } }...