FLINT3.7.0-dev

_arf_mpn_cinv_approx, _arf_mpn_cdiv_approx, _arf_mpn_csqrt_approx, _arf_mpn_crsqrt_approx

Synopsis#include <flint/arf.h>
void _arf_mpn_cinv_approx(nn_ptr re, slong * reexp, nn_ptr im, slong * imexp, nn_srcptr a, slong an, slong ea, nn_srcptr b, slong bn, slong eb, slong prec)source
void _arf_mpn_cdiv_approx(nn_ptr re, slong * reexp, int * reneg, nn_ptr im, slong * imexp, int * imneg, nn_srcptr a, slong an, slong ea, int sa, nn_srcptr b, slong bn, slong eb, int sb, nn_srcptr c, slong cn, slong ec, int sc, nn_srcptr d, slong dn, slong ed, int sd, slong prec)source
void _arf_mpn_csqrt_approx(nn_ptr re, slong * reexp, nn_ptr im, slong * imexp, nn_srcptr a, slong an, slong ea, int sa, nn_srcptr b, slong bn, slong eb, slong prec)source
void _arf_mpn_crsqrt_approx(nn_ptr re, slong * reexp, nn_ptr im, slong * imexp, nn_srcptr a, slong an, slong ea, int sa, nn_srcptr b, slong bn, slong eb, slong prec)source

The reciprocal, the quotient, the square root and the reciprocal square root of complex numbers given as mantissa/exponent pairs: a part is {a,an} 2ea−anB\{a, \mathit{an}\} \, 2^{e_a - \mathit{an} B} with a normalised mantissa, a nonzero magnitude and an slong exponent far from overflow (the callers scale extreme operands). The _approx flavour writes rn\mathit{rn} limbs per part, each within about an ulp of the magnitude of the result (the parts truncated), with the exponents of the parts (WORD_MIN for an exactly cancelled part of the quotient); the outputs are the magnitudes of the parts, the signs being the caller's unless stated. The reciprocal is (a−bi)t(a - b i) t with t=1/(a2+b2)t = 1/(a^2 + b^2), written as ata t and btb t. The quotient (a+bi)/(c+di)=(u+vi)t(a + b i)/(c + d i) = (u + v i) t with u=ac+bdu = a c + b d, v=bc−adv = b c - a d and t=1/(c2+d2)t = 1/(c^2 + d^2) takes the signs of the operands and returns those of the parts. The square root is (q,b/(2q))(q, b/(2q)) with q=(∣z∣+∣a∣)/2q = \sqrt{(|z| + |a|)/2} for a≥0a \ge 0 and (∣b∣/(2q),q)(|b|/(2q), q) for a<0a < 0 (the imaginary part has the sign of bb); the reciprocal square root is (Tv,bv)(T v, b v) resp. (bv,Tv)(b v, T v) with T=∣z∣+∣a∣T = |z| + |a| and v=1/2∣z∣2Tv = 1/\sqrt{2 |z|^2 T} (the imaginary part has the sign opposite to bb). The outputs may alias the operands' limbs.

The compositions of nfloat_complex on the _approx kernels, every intermediate held at rn+1\mathit{rn} + 1 limbs (the guard limb keeps the few ulps of the compositions below the ulp of the output, as the 22−prec2^{2 - \mathit{prec}} of acf's callers requires) and each kernel within an ulp: ∣z∣2|z|^2 from two approximate squares and a truncated sum, one reciprocal shared by the two parts of a quotient (a division costs several products), ∣z∣|z| by the exact root, the larger part of a root first so that nothing cancels.

Cite this page

The FLINT team, “_arf_mpn_cinv_approx, _arf_mpn_cdiv_approx, _arf_mpn_csqrt_approx, _arf_mpn_crsqrt_approx (arf.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/arf/_arf_mpn_cinv_approx.html (generated 2026-11-20).