FLINT3.7.0-dev

ca_sqrt_inert, ca_sqrt_nofactor, ca_sqrt_factor, ca_sqrt

Synopsis#include <flint/ca.h>
void ca_sqrt_inert(ca_t res, const ca_t x, ca_ctx_t ctx)source
void ca_sqrt_nofactor(ca_t res, const ca_t x, ca_ctx_t ctx)source
void ca_sqrt_factor(ca_t res, const ca_t x, ulong flags, ca_ctx_t ctx)source
void ca_sqrt(ca_t res, const ca_t x, ca_ctx_t ctx)source

Sets res to the principal square root of x, with \operatorname{Re}(\sqrt{x}) \ge 0 and \sqrt{x} = i \sqrt{|x|} for negative real x.

The inert version returns the generator of the field \mathbb{Q}(\sqrt{x}) without trying to simplify. The nofactor version tries cheap simplifications, in particular an exact evaluation of \sqrt{x} as an algebraic number of moderate degree. The factor version also writes x = A^2 B by factoring the representation of x (with the factorisation options flags, see ca_factor) and returns \pm A \sqrt{B} with the sign chosen to give the principal root; the factorisation is a heuristic and B need not be minimal. ca_sqrt currently calls ca_sqrt_factor with CA_FACTOR_POLY_SQF | CA_FACTOR_ZZ_SMOOTH, so that for example \sqrt{12 \pi} becomes 2 \sqrt{3 \pi}.

For special values: \sqrt{c \infty} = \sqrt{c} \, \infty, \sqrt{\tilde \infty} = \tilde \infty, and Undefined and Unknown map to themselves.

Guides#

Cite this page

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