FLINT3.7.0-dev

_mp_real_sin_cos_fp, _mp_real_tan_fp, _mp_real_sin_cos_pi_fp, _mp_real_tan_pi_fp

Synopsis#include <flint/mp_real.h>
int _mp_real_sin_cos_fp(nn_ptr ys, nn_ptr yc, slong * w, ulong * err, nn_srcptr d, slong n, slong e, slong pb, slong wmax, int rel)source
int _mp_real_tan_fp(nn_ptr y, slong * w, ulong * err, int * recip, nn_srcptr d, slong n, slong e, slong pb, slong wmax)source
int _mp_real_sin_cos_pi_fp(nn_ptr ys, nn_ptr yc, slong * w, slong * k, ulong * err, nn_srcptr d, slong n, slong e, slong pb, slong wmax, int rel)source
int _mp_real_tan_pi_fp(nn_ptr y, slong * w, slong * k, ulong * err, int * recip, nn_srcptr d, slong n, slong e, slong pb, slong wmax)source

The trigonometric functions of the magnitude ∣x∣=(d,n) 2e−n FLINT_BITS|x| = (d, n) \, 2^{e - n \, \mathtt{FLINT\_BITS}}, e≤2FLINT_BITS−3e \le 2^{\mathtt{FLINT\_BITS} - 3}, or of π∣x∣\pi |x| (the pi versions); the caller applies the sign of xx to the odd functions. The outputs are fixed-point values (y,w+1)(y, w + 1) at ww fraction limbs within err units, with nk≤w≤wmax\mathit{nk} \le w \le \mathit{wmax}: the kernels add limbs beyond nk for the relative accuracy of a sine or tangent near its zeros as far as wmax allows (w=w = _mp_real_elem_limbs(pb + z) for zz leading zero bits); for the sine and cosine, rel says which outputs need that relative accuracy (bit 0 the sine, bit 1 the cosine), so that an output wanted only for a bound costs no extra limbs. Buffers need wmax + 2 limbs (the sine and tangent of the pi versions max(n, nk) + 3 as well). The return value carries the signs (bit 0: the sine or tangent is negative, bit 1: the cosine is negative), or MP_REAL_TRIG_EXACT with the quadrant in bits 0–1 when the values are exact (0, 1 / 1, 0 / 0, −1-1 / −1-1, 0; the tangent 0 or a pole, or ±1\pm 1 with MP_REAL_TRIG_ONE), or MP_REAL_TRIG_TINY for a tiny xx of the pi versions, where the sine or tangent is πx(1∓δ)\pi x (1 \mp \delta) returned as a product with a radix-2 exponent k and err = 6, within one-sided bounds. For the tangent, recip = 1 means that the value is ±1/Y\pm 1 / Y rather than ±Y\pm Y; the kernel chooses the limbs so that YY normalises with a left shift of at most MP_REAL_TRIG_FP_NORM_SHIFT bits.

In the pi versions, a reduced argument t=m/2jt = m/2^j with a denominator of at most FLINT_BITS−8\mathtt{FLINT\_BITS} - 8 bits is evaluated by _mp_real_sin_cos_pi_ui_div_ui resp. _mp_real_tan_pi_ui_div_ui instead of the kernel on πt\pi t wherever their algebraic methods win (_mp_real_sin_cos_pi_ui_div_ui_algebraic): sin⁡(π/4)\sin(\pi/4) by one square root, 3/163/16 by half angles from about 24 limbs, and so on.

Cite this page

The FLINT team, “_mp_real_sin_cos_fp, _mp_real_tan_fp, _mp_real_sin_cos_pi_fp, _mp_real_tan_pi_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_sin_cos_fp.html (generated 2026-11-17).