ca_get_fmpz, ca_get_fmpq, ca_get_qqbar
#include <flint/ca.h>Attempts to evaluate x to an explicit integer, rational number or algebraic number. On success, sets res to this number and returns 1; otherwise returns 0 and leaves res unspecified.
The conversion fails if x is a special value or is not an integer, rational or algebraic number, but it can also fail when x is one. An element of a field with one algebraic generator is always converted. In other fields, the extension numbers must themselves be evaluable to algebraic numbers (see ca_can_evaluate_qqbar); the numerator and denominator are then evaluated with qqbar.h arithmetic, which is aborted when an intermediate result, or more precisely a resultant before factorisation, has degree larger than CA_OPT_QQBAR_DEG_LIMIT or coefficients larger than about 10 \cdot CA_OPT_PREC_LIMIT bits. These limits can be reached even if the minimal polynomial of x is small.
Guides#
- Using ca
- Using qqbar (
qqbar)
The FLINT team, “ca_get_fmpz, ca_get_fmpq, ca_get_qqbar (ca.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/ca/ca_get_fmpz.html (generated 2026-10-20).
@misc{flint-doc-ca-ca-get-fmpz,
author = {{The FLINT team}},
title = {{ca\_get\_fmpz, ca\_get\_fmpq, ca\_get\_qqbar (ca.h)}},
howpublished = {FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev},
year = {2026},
url = {https://flintlib.org/doc/ca/ca_get_fmpz.html},
note = {Generated 2026-10-20}
}