FLINT3.7.0-dev

flint_mpn_get_str

Synopsis#include <flint/mpn_extras.h>
char * flint_mpn_get_str(char * res, int base, mp_srcptr x, mp_size_t xn, int negative)source

Returns the representation of (x, \mathit{xn}), or of its negation if negative is 1, in the given base, which must be one supported by GMP (2 \le base \le 62). If res is NULL, a new string is allocated with flint_malloc; otherwise res must have room for all the digits, one extra digit, a minus sign and the terminating null.

In base 10 and with fft_small, the conversion is done with the radix module (radix_set_mpn into the radix 10^{19}, then radix_get_str_decimal) except for 40 < \mathit{xn} < 1400, where GMP's mpz_get_str is faster; other bases and builds without fft_small use mpz_get_str. See Radix conversion.

Cite this page

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