FLINT3.7.0-dev

vec1d_mulmod_fast, vec4d_mulmod_fast, vec8d_mulmod_fast, vec1d_nmulmod_fast, vec4d_nmulmod_fast, vec8d_nmulmod_fast

Synopsis#include <flint/machine_vectors.h>
vec1d vec1d_mulmod_fast(vec1d a, vec1d b, vec1d n, vec1d ninv)
vec4d vec4d_mulmod_fast(vec4d a, vec4d b, vec4d n, vec4d ninv)
vec8d vec8d_mulmod_fast(vec8d a, vec8d b, vec8d n, vec8d ninv)
vec1d vec1d_nmulmod_fast(vec1d a, vec1d b, vec1d n, vec1d ninv)
vec4d vec4d_nmulmod_fast(vec4d a, vec4d b, vec4d n, vec4d ninv)
vec8d vec8d_nmulmod_fast(vec8d a, vec8d b, vec8d n, vec8d ninv)

Like mulmod and nmulmod, with the quotient rounded by round_mul. Requires |ab| < 2n^2 and n < 2^{50}. The result then satisfies |r| \le n/2 + \eta|ab| as for mulmod, and also |r| \le n/2 + 2.0001 \cdot 2^{-53}|ab| on the magic-constant path, so |r| < n if n < 2^{49} or fft_small_mulmod_satisfies_bounds(n) holds. With the magic constant, a product beyond 2^{51} n in absolute value gives a wrong result, possibly not an integer. With native rounding, and always on NEON, these functions are mulmod and nmulmod. AVX2 and NEON.

Cite this page

The FLINT team, “vec1d_mulmod_fast, vec4d_mulmod_fast, vec8d_mulmod_fast, vec1d_nmulmod_fast, vec4d_nmulmod_fast, vec8d_nmulmod_fast (machine_vectors.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/machine_vectors/vec1d_mulmod_fast.html (generated 2026-10-20).