New mini-gmp macro GMP_CMP?

Marco Bodrato bodrato at mail.dm.unipi.it
Sat Nov 26 22:50:38 UTC 2016


Ciao,

Il Gio, 24 Novembre 2016 4:44 pm, Niels Möller ha scritto:

> Looks fine to me. I find the result on overflow a bit odd (but I think
> it's the same as gmp). If I understand it correctly, the value v of
> mpz_get_si (u), is defined by the conditions
>
>   sgn(v) == sgn(u) and
>   v == u (mod GMP_LIMB_HIGHBIT)
>
> Is that right?

The manual says:

"[...] Otherwise return the least significant part of op, with the same
sign as op."

... but both the definition on the manual and your do not completely
satisfy me.

mpz_get_si(2^1000) returns 0, and the sign is not the same...

Regards,
m

-- 
http://bodrato.it/



More information about the gmp-devel mailing list