FLINT3.7.0-dev

nfloat_complex_inv, nfloat_complex_div, nfloat_complex_sqrt, nfloat_complex_rsqrt

Synopsis#include <flint/nfloat.h>
int nfloat_complex_inv(nfloat_complex_ptr res, nfloat_complex_srcptr x, gr_ctx_t ctx)source
int nfloat_complex_sqrt(nfloat_complex_ptr res, nfloat_complex_srcptr x, gr_ctx_t ctx)source
int nfloat_complex_rsqrt(nfloat_complex_ptr res, nfloat_complex_srcptr x, gr_ctx_t ctx)source

Inverse, quotient, square root and reciprocal square root (principal branches), with errors of a few ulps relative to the magnitude of the result. Purely real or imaginary operands are handled with the real functions.

The inverse and the quotient are \bar{y}/|y|^2 and x\bar{y}/|y|^2 with a single reciprocal of |y|^2 shared by both parts (operands whose parts differ greatly in magnitude, or have extreme exponents, are rescaled first). At one word, |y|^2 is formed in registers and truncated to one word, and both parts of the numerator are divided by it with one shared inverse.

The square root of z = a + bi is computed from r = |z| (by nfloat_hypot at one and two words and for extreme exponents, otherwise as \sqrt{a^2 + b^2}) as q = \sqrt{(r + |a|)/2} and b/(2q), assigned to the real and imaginary parts according to the sign of a, so that nothing cancels; the reciprocal square root uses v = 1/\sqrt{2r^2(r + |a|)} and the products (r + |a|)v and bv. At one word on 64-bit machines, both are computed in registers.

Cite this page

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