FLINT3.7.0-dev

_mp_real_atan_fp, _mp_real_atan2_fp

Synopsis#include <flint/mp_real.h>
void _mp_real_atan_fp(nn_ptr y, slong * w, ulong * err, nn_srcptr d, slong n, slong e, slong pb, slong wmax)source
void _mp_real_atan2_fp(nn_ptr y, slong * len, slong * ue, ulong * elo, ulong * ehi, nn_srcptr num, slong nn, nn_srcptr den, slong dn, slong d, int c, int sigma, slong pb, slong wmax)source

_mp_real_atan_fp sets (y,w+1)(y, w + 1) to atan⁡∣x∣⋅Bw\operatorname{atan}|x| \cdot B^w within err units for ∣x∣=(d,n) 2e−n FLINT_BITS|x| = (d, n) \, 2^{e - n \, \mathtt{FLINT\_BITS}}, with w=min⁡(w = \min(_mp_real_elem_limbs(pb - e),wmax), \mathit{wmax}) for ∣x∣<1|x| < 1 (the relative accuracy of small arguments; the caller handles tiny xx) and w=nkw = \mathit{nk} otherwise, where ∣x∣>1|x| > 1 is evaluated as π/2−atan⁡(1/∣x∣)\pi/2 - \operatorname{atan}(1/|x|); y needs wmax + 1 limbs. _mp_real_atan2_fp evaluates θ=cπ/4+σatan⁡(t)\theta = c \pi/4 + \sigma \operatorname{atan}(t) for t=(Mnum/Mden)2−d<1t = (M_{\mathit{num}} / M_{\mathit{den}}) 2^{-d} < 1 with the mantissas (num,nn)(\mathit{num}, \mathit{nn}) and (den,dn)(\mathit{den}, \mathit{dn}) in [1/2,1)[1/2, 1), d≥0d \ge 0, c∈{0,2,4}c \in \{0, 2, 4\} and σ=±1\sigma = \pm 1 (the caller sorts ∣x∣|x| and ∣y∣|y| into the octants and applies the sign of yy): the result is (y,len) 2ue(y, \mathit{len}) \, 2^{\mathit{ue}} within elo units below and ehi units above. For c=0c = 0 and a tiny tt (when 2(d−1)≥FLINT_BITS (nk+1)+42(d - 1) \ge \mathtt{FLINT\_BITS} \, (\mathit{nk} + 1) + 4) this is the exact floor of the ratio itself at nk + 1 limbs, with θ=t(1−δ)\theta = t(1 - \delta) and δt\delta t below a unit, so that the bounds are one-sided; otherwise the arctangent at w=min⁡(w = \min(_mp_real_elem_limbs(pb + d - 1),wmax), \mathit{wmax}) (c=0c = 0) resp. nk limbs. y needs wmax + 2 limbs (wmax ≥\ge nk + 1).

Cite this page

The FLINT team, “_mp_real_atan_fp, _mp_real_atan2_fp (mp_real.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/mp_real/_mp_real_atan_fp.html (generated 2026-11-17).