GMP Problem with % under C++
Marco Bodrato
bodrato at mail.dm.unipi.it
Thu Nov 5 21:54:56 UTC 2020
Ciao,
Il 2020-11-05 22:27 Niels Möller ha scritto:
> I think this is the same result you get with a plain (64-bit) long. The
> / and % operators in C++ produce a quotient rounded towards 0, so (f(1)
> - b) / DECKSIZE == 0, and the corresponding remainder is negative.
> I'm not that familiar with perl, but I guess it uses the mathematically
> more sane definition of always rounding the quotient towards -infinity,
Every language has its own definition :-)
https://en.wikipedia.org/wiki/Modulo_operation#In_programming_languages
Ĝis,
m
More information about the gmp-bugs
mailing list