FLINT3.7.0-dev

fmpq_poly_set_str

Synopsis#include <flint/fmpq_poly.h>
int fmpq_poly_set_str(fmpq_poly_t poly, const char * str)source

Sets poly to the polynomial specified by the null-terminated string str. The input format is the same as the output format of fmpq_poly_get_str: the length given as a decimal integer, then two spaces, then the list of coefficients separated by one space.

The result is only guaranteed to be in canonical form if all coefficients in the input string are in lowest terms.

Returns 0 if no error occurred. Otherwise, returns -1 in which case the resulting value of poly is set to zero. If str is not null-terminated, calling this method might result in a segmentation fault.

Guides#

Cite this page

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