FLINT3.7.0-dev

mpn_mod_set_ui, mpn_mod_set_si, mpn_mod_set_fmpz

Synopsis#include <flint/mpn_mod.h>
int mpn_mod_set_ui(nn_ptr res, ulong x, gr_ctx_t ctx)source
int mpn_mod_set_si(nn_ptr res, slong x, gr_ctx_t ctx)source
int mpn_mod_set_fmpz(nn_ptr res, const fmpz_t x, gr_ctx_t ctx)source

Set res to x \bmod n, for any integer x.

Since n > 2^{\mathtt{FLINT\_BITS}}, a ulong needs no reduction and a negative slong becomes n - |x|. An fmpz with as many limbs as n or more is reduced with mpn_mod_set_mpn and negated if negative.

Guides#

Cite this page

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