Why am I getting the wrong output?
Shlomi Fish
shlomif at shlomifish.org
Sun Jul 15 00:28:22 CEST 2012
Hi Torbjorn,
first of all I should note that someone on #gnu on Freenode had alreaedy helped
me and everything is now working beautifully.
On Sat, 14 Jul 2012 19:29:58 +0200
Torbjorn Granlund <tg at gmplib.org> wrote:
> Shlomi Fish <shlomif at shlomifish.org> writes:
>
> GMP: 4444 % 52 == 28
> [C]: 4444 % 52 == 24
>
> Why?
>
> Why not? Did you expect something else?
>
Well, I naïvely expected mpz_cdiv_qr_ui to do a floor division/modulo (having
not read the documentation thoroughly enough), but I wanted "fdiv" (floor
division) instead of "cdiv".
> Is this a bug?
>
> In GMP, you mean? No, it computes the remainder exactly as documented.
>
> I doubt the C remainder operator % is ddfined to do ceiling rounding on
> any system. It is certainly not required to do that, so your C compiler
> is also DTRT.
>
I understand. Thanks.
Regards,
Shlomi Fish
P.S: sending messages to listadmin at gmplib.org (and the aliases of *-owner) from
either shlomif at shlomifish.org or shlomif at gmail.com generates this message:
<< Recipient address rejected: Address blocked due to spamming. Please contact
us by phone for listadmin issues. (state 13). >>
Can this be fixed?
--
-----------------------------------------------------------------
Shlomi Fish http://www.shlomifish.org/
"Star Trek: We, the Living Dead" - http://shlom.in/st-wtld
<rindolf> I am not solvable. I am Turing hard.
Please reply to list if it's a mailing list post - http://shlom.in/reply .
More information about the gmp-discuss
mailing list