mpn_neg

Vincent Lefevre vincent at vinc17.net
Tue May 7 10:58:59 CEST 2013


On 2013-05-07 10:43:33 +0200, Zimmermann Paul wrote:
> I discovered the mpn_neg function:
> 
>  -- Function: mp_limb_t mpn_neg (mp_limb_t *RP, const mp_limb_t *SP,
>           mp_size_t N)
>      Perform the negation of {SP, N}, and write the result to {RP, N}.
>      Return carry-out.
> 
> Since mpn only deals with nonnegative numbers, what is "the negation of
> {SP, N}"? Also, should the carry be a borrow?

Isn't this the equivalent of mpn_sub_n where the first term of
the subtraction is equal to 0? But for mpn_sub_n, it is said
"borrow" for the returned value.

-- 
Vincent Lefèvre <vincent at vinc17.net> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


More information about the gmp-discuss mailing list