vec1d_round_mul, vec4d_round_mul
#include <flint/machine_vectors.h>Returns ab rounded to an integer. With the magic constant (see FLINT_FFT_SMALL_ROUND_USE_NATIVE) this is the nearest integer to the exact product, with ties to even, and requires |ab| \le 2^{51}; a larger product gives a wrong value or a non-integer. With native rounding it is round(mul(a, b)), which rounds twice and has no size condition. AVX2 only.
The magic-constant path computes fmadd(a, b, R) - R with R = 1.5 \cdot 2^{52}. When |ab| \le 2^{51}, the exact sum ab + R lies in [2^{52}, 2^{53}], where consecutive doubles are 1 apart, so the single rounding of the FMA rounds ab to the nearest integer. This avoids vroundpd, which is slow on Intel cores.
The FLINT team, “vec1d_round_mul, vec4d_round_mul (machine_vectors.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/machine_vectors/vec1d_round_mul.html (generated 2026-10-20).
@misc{flint-doc-machine-vectors-vec1d-round-mul,
author = {{The FLINT team}},
title = {{vec1d\_round\_mul, vec4d\_round\_mul (machine\_vectors.h)}},
howpublished = {FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev},
year = {2026},
url = {https://flintlib.org/doc/machine_vectors/vec1d_round_mul.html},
note = {Generated 2026-10-20}
}