Skip to content

Conversation

@sjaeckel
Copy link
Member

@sjaeckel sjaeckel commented May 18, 2019

I've noticed that the test-case for balanced multiplication wasn't hit anymore (or probably never? :-D ).

While looking at the coverage results I added some trivial ones and I think I found an inconsistency... nothing bad but it still stood out while looking at the code...

mp_prime_rabin_miller_trials:38 leads to 2 MR trials for numbers > 4096 bits

@czurnieden is that change fine that not only 4096bit sized numbers only have to do 1 MR but also numbers >4096bits?

moved to #269

@sjaeckel sjaeckel requested review from czurnieden and minad May 18, 2019 10:25
}
}
return sizes[x-1].t + 1;
return sizes[x-1].t;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this is the inconsistency? I cannot judge this since I never looked into those prime tests. Ping @czurnieden?

@minad
Copy link
Member

minad commented May 18, 2019

@sjaeckel Maybe split this PR in two if there is an issue with the prime tests, which needs more work?
balance_mul and the testing stuff looks good modulo nitpicks.

@sjaeckel sjaeckel force-pushed the improve-coverage branch 3 times, most recently from b9f8f9c to 3b2a48f Compare May 18, 2019 10:47
@sjaeckel
Copy link
Member Author

split into two PR's as they're independent

@czurnieden
Copy link
Contributor

czurnieden commented May 18, 2019

mp_prime_rabin_miller_trials returns 39 in that special case which is too much for 8-bit. The test for t > MP_PRIME_SIZE fails because MP_PRIME_SIZE is only 31 for MP_8BIT.

There are many places available to repair/work-around that. Any preferences?

That test (under /* valid value of t? */) is obsolete, only random witnesses get used in mp_prime_is_prime now, the restrictions of ltm_prime_tab are irrelevant.

EDIT II:
There is a method available to run a sequence of M-R tests where the restrictions of ltm_prime_tab are relevant and that is if the value of -t is bigger than MP_PRIME_SIZE in the deterministic test. That was a failed attempt to keep some sort of downwards compatibility.
I think it should go, too, or do you want to keep it?

Copy link
Contributor

@czurnieden czurnieden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've noticed that the test-case for balanced multiplication wasn't hit anymore (or probably never? :-D ).

I checked it with one of my (in)famous puts("DDD"); and it got hit, yes.

But it is better that way, of course.

@minad
Copy link
Member

minad commented May 18, 2019

@sjaeckel Why is this failing? Maybe move all the prime sieve stuff to #269. Then balanced mul and fread/fwrite tests can already be merged.

@czurnieden
Copy link
Contributor

Why is this failing?

I tried to explain it?

@minad
Copy link
Member

minad commented May 18, 2019

@czurnieden Sorry, I didn't read your explanation first because I thought you commented here instead of in #269. I thought @sjaeckel moved all the "critical" stuff to #269.

@czurnieden
Copy link
Contributor

Sorry, I didn't read your explanation first because I thought you commented here instead of in #269

I think I slowly grasp github's UI/UX but you're right, of course, to be still sceptical ;-)

But now that I have you: do you think it is enough to just delete the first test (could be done in this PR) or get rid of the second part, too (needs more work, including change of documentation, hence its own PR)?

@minad
Copy link
Member

minad commented May 18, 2019

But now that I have you: do you think it is enough to just delete the first test (could be done in this PR) or get rid of the second part, too (needs more work, including change of documentation, hence its own PR)?

Hmm, I am not sure I really got you. Do you want to get rid of this ltm_primetab division test and replace it with your sieve? Then the specific ltm_primetab tests can go to (what you wrote under Edit II).

@sjaeckel sjaeckel force-pushed the improve-coverage branch from 7cdaaa3 to 8b2cbea Compare May 19, 2019 07:55
@sjaeckel
Copy link
Member Author

I thought @sjaeckel moved all the "critical" stuff to #269.

Sorry, I thought so too :-) ... fixed now

@czurnieden
Copy link
Contributor

Hmm, I am not sure I really got you.

Then let me assure you: you didn't—it seems as if I was not able to explain it with words.
So let me express myself in code.
Two PRs, one to repair the failure herein #269, one explaining what I meant.
(may take some time, am on an old laptop now that isn't the fastest)

@minad
Copy link
Member

minad commented May 19, 2019

Then let me assure you: you didn't—it seems as if I was not able to explain it with words. So let me express myself in code. Two PRs, one to repair the failure herein #269, one explaining what I meant. (may take some time, am on an old laptop now that isn't the fastest)

Thanks! That's better. I'll add a comment in #272.

@sjaeckel sjaeckel force-pushed the improve-coverage branch from 8b2cbea to cb3ff8c Compare May 21, 2019 07:45
@sjaeckel sjaeckel merged commit b31a108 into develop May 21, 2019
@sjaeckel sjaeckel deleted the improve-coverage branch May 21, 2019 07:46
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

Successfully merging this pull request may close these issues.

4 participants