mpn_mod_inv
Synopsis
#include <flint/mpn_mod.h>Sets res to and returns GR_SUCCESS if . Otherwise returns GR_DOMAIN, or GR_UNABLE if is nonzero and the ring pretends to be a field (recording , see Context objects); res is then left unchanged.
The inverse is computed with GMP's extended gcd mpn_gcdext, except for , which are their own inverses.
Guides#
Cite this page
The FLINT team, “mpn_mod_inv (mpn_mod.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/mpn_mod/mpn_mod_inv.html (generated 2026-11-02).
@misc{flint-doc-mpn-mod-mpn-mod-inv,
author = {{The FLINT team}},
title = {{mpn\_mod\_inv (mpn\_mod.h)}},
howpublished = {FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev},
year = {2026},
url = {https://flintlib.org/doc/mpn_mod/mpn_mod_inv.html},
note = {Generated 2026-11-02}
}