FLINT3.7.0-dev

nfloat_set_mpn_2exp, _nfloat_set_mpn_2exp

Synopsis#include <flint/nfloat.h>
int nfloat_set_mpn_2exp(nfloat_ptr res, nn_srcptr x, slong xn, slong exp, int xsgnbit, gr_ctx_t ctx)source
int _nfloat_set_mpn_2exp(nfloat_ptr res, nn_srcptr x, slong xn, slong exp, int xsgnbit, gr_ctx_t ctx)source

Set res to (-1)^{\mathit{xsgnbit}} \cdot f \cdot 2^{\mathit{exp}}, where f = \{x, \mathit{xn}\} / 2^{\mathit{xn} \cdot \mathtt{FLINT\_BITS}} is the fraction in [0, 1) given by the xn words of x, rounded to the precision of the context. The version with an underscore requires that the top word x[xn - 1] is nonzero; the other removes leading zero words and handles f = 0.

Cite this page

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