GMP Problem with % under C++

sisyphus sisyphus359 at gmail.com
Fri Nov 6 01:25:47 UTC 2020


On Fri, Nov 6, 2020 at 8:27 AM Niels Möller <nisse at lysator.liu.se> wrote:

> [snip]
>
> So your problem really is with % in C++, GMP just follows the
> conventions for the builtin integers.
>

Rather, the OP is expecting that the ''%" operator in his C++ program will
behave as mpz_mod() does - which is the same way as the "%" operator
behaves in perl.
To me, it's not surprising that he would have that expectation.
I'm not saying that it's a *reasonable* expectation, as I don't know C++.

To the op:
If you want to get gmp performance into your perl script, then install
Math::GMP and, instead of:

use bigint;
do:
use bigint lib => 'GMP';


More information about the gmp-bugs mailing list