Simple divisions returning yes/no remainder?

Carl Ponder cponder at nvidia.com
Mon Nov 16 14:08:46 UTC 2020


I'm using these functions to compute some rounded integer quotients

    Function: /void/ *mpz_cdiv_q* /(mpz_t q, const mpz_t n, const mpz_t d)/

    Function: /void/ *mpz_fdiv_q* /(mpz_t q, const mpz_t n, const mpz_t d)/

I'd also like to know, though, if the remainder is non-zero without 
having to perform additional arithmetic steps.
Would it be possible for these functions to return a boolean for this?
I expect that the algorithm would have some state-information that would 
be easy to test at the end of the calculation, as opposed to performing 
extra arithmetic.
Thanks,

                     Carl



More information about the gmp-discuss mailing list