FLINT3.7.0-dev

mpn_mod_neg, mpn_mod_add, mpn_mod_sub

Synopsis#include <flint/mpn_mod.h>
int mpn_mod_neg(nn_ptr res, nn_srcptr x, gr_ctx_t ctx)source
int mpn_mod_add(nn_ptr res, nn_srcptr x, nn_srcptr y, gr_ctx_t ctx)source
int mpn_mod_sub(nn_ptr res, nn_srcptr x, nn_srcptr y, gr_ctx_t ctx)source

Set res to -x, x + y and x - y modulo n, with one conditional correction. Two-limb moduli use the inline functions flint_mpn_negmod_2, flint_mpn_addmod_2 and flint_mpn_submod_2.

Cite this page

The FLINT team, “mpn_mod_neg, mpn_mod_add, mpn_mod_sub (mpn_mod.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/mpn_mod/mpn_mod_neg.html (generated 2026-10-20).