dead code in div_q.c?

Niels Möller nisse at
Fri Apr 27 08:57:15 UTC 2018

paul zimmermann <Paul.Zimmermann at> writes:

>> It would be good to either prove that qh > 0 can't happen, or add a test
>> that will exercise the code handling that case.
> yes more generally it would be nice to know for the divappr functions, if the
> exact quotient fits on qn limbs (i.e., the exact qh is 0), can the
> "approximate" qh be 1?

I suspect we may have qh == 0 always in this special context, where we
have additional constraints on N and D.

But in general, I doubt we can promise that the qh return value from
divappr euals what we would get for the correct quotient. I.e., that the
qh return values from div and divappr always match. Seems particularly
unlikely for the mu divappr, which can have an error larger than 1 unit.

Not sure how to come up with an example, though.


Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677.
Internet email is subject to wholesale government surveillance.

More information about the gmp-devel mailing list