Conversation
|
The new commit, "Fix bug", which I have not personally reviewed, passes my personal code! Thank you! |
This is from the "Fix bug" commit I prior commented worked for my prior noted issues. I'm actually using it in the same context, solely running a different test suite, so I'm unsure why this current test suite is managing to trip this low-level bug when my prior one didn't. I'll try to find a reproducible test case, but at least having noted this ideally lets some review be started on. EDIT: |
|
@kayabaNerve, thank you for being a persistent tester! I hope to find some time later this week to debug the issue you presented. I appreciate your patience! (I'm delighted I added in those |
|
Also just hit |
@kayabaNerve I had a quick look today. Your counterexample demonstrates there are more annoying ways in which the |
|
I did try poking at this myself to see if I could fix it, but it really wasn't immediately familiar/obvious to me. I ended up just making a fork which never uses the optimized algorithm as to not block my work. Pros: Works. I may try to work on this again if I myself have free time before the deadline, but any further help from you would truly be appreciated! This truly is a massive improvement for crypto-bigint on this topic and it's fundamentally what makes my current research topic go from 'initial impl for reference which isn't discussable' to 'initial impl which yields feasible results for practical deployment'. EDIT: The Bezout coefficients are correct or their additive inverse modulo the other value divided by their GCD, for this specific test case. From these incorrect values, it's trivial to calculate the proper values with a post-processing run. I tried to do so on every result, to restore functioning despite not having a proper fix, but that yields other errors so this isn't a universal fact. |
|
I've worked on this here-and-there for the past couple days, without much luck. The problemThe failing input presented by @kayabaNerve illustrates that the trick does not always apply. SolutionsI've thought of a couple solutions: 1) Using
|
@erik-3milabs if it's just a single extra limb, with some effort you could always make a struct that adds that extra limb which avoids type-level size calculations |
|
@erik-3milabs looks like this one needs a rebase |
|
Alright, it took some time, but I think I managed to fix the bug.
@tarcieri this was indeed the solution. I thought this couldn't work, because you'd have to multiply two of these
To ease the review process, I propose to split this PR into (at least) two parts:
As such, this PR will remain a draft for a bit longer. |
This implementation is from an open PR (RustCrypto/crypto-bigint#761) done by erik-3milabs. We rely on it now for how much more efficient it is. We ideally, would use binxgcd, not bingcd, yet the bingxcd implementation occassionally returns invalid `u, v` coefficients. We accordingly can solely use its bingcd right now.
Continuation of the work started in #755