Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect values for modInverse function #289

Open
HoangNguyen219 opened this issue May 12, 2024 · 1 comment
Open

Incorrect values for modInverse function #289

HoangNguyen219 opened this issue May 12, 2024 · 1 comment
Assignees

Comments

@HoangNguyen219
Copy link

HoangNguyen219 commented May 12, 2024

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);
    }
@ionspin ionspin self-assigned this May 12, 2024
@ionspin
Copy link
Owner

ionspin commented May 12, 2024

Thanks for reporting, I'll give it a look when I have some free time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants