FLINT3.7.0-dev

mp_real_set_trunc

Synopsis#include <flint/mp_real.h>
void mp_real_set_trunc(mp_real_t res, const mp_real_t x, slong n)source

Set res to xx rounded to its top n≥1n \ge 1 limbs (a copy if xx has at most nn limbs). res may alias xx.

The dropped tail and the old radius are each below one ulp of the new last limb, so the new radius is [tail≠0]+[radius≠0][\mathrm{tail} \ne 0] + [\mathrm{radius} \ne 0] ulps. The result is exact if nothing nonzero is dropped from an exact input.

Cite this page

The FLINT team, “mp_real_set_trunc (mp_real.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/mp_real/mp_real_set_trunc.html (generated 2026-11-02).