kotlin-multiplatform-bignum
kotlin-multiplatform-bignum copied to clipboard
Incorrect values for modInverse function
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
)
Expected :1141223
Actual :-16697
Expected behavior In java.math this test is successful:
@Test
public void testModInverse() {
BigInteger a = new BigInteger("54647")
.modInverse(new BigInteger("1157920"));
assertEquals(new BigInteger("1141223"), a);
}
Thanks for reporting, I'll give it a look when I have some free time.
Fixed in #306