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 Re⁡(x)≥0\operatorname{Re}(\sqrt{x}) \ge 0 and x=i∣x∣\sqrt{x} = i \sqrt{|x|} for negative real xx.

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

For special values: c∞=c ∞\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-11-02).