FLINT3.7.0-dev

arb_sin_cos_pi_fmpq, arb_sin_pi_fmpq, arb_cos_pi_fmpq, arb_tan_pi_fmpq

Synopsis#include <flint/arb.h>
void arb_sin_cos_pi_fmpq(arb_t s, arb_t c, const fmpq_t x, slong prec)source
void arb_sin_pi_fmpq(arb_t s, const fmpq_t x, slong prec)source
void arb_cos_pi_fmpq(arb_t c, const fmpq_t x, slong prec)source
void arb_tan_pi_fmpq(arb_t t, const fmpq_t x, slong prec)source

Set s to sin⁡(πx)\sin(\pi x), c to cos⁡(πx)\cos(\pi x) and t to tan⁡(πx)\tan(\pi x) for a rational xx, with full relative accuracy also near the zeros. The tangent is indeterminate exactly at the poles (the half-integers). The rational values (00, ±1/2\pm 1/2, ±1\pm 1, and tan⁡(πx)=±1\tan(\pi x) = \pm 1) are exact.

For a word-size denominator at precisions where an algebraic method is faster than evaluating the function of πx\pi x (square roots for small denominators, half-angle steps for q=2kq0q = 2^k q_0 with q0=1,3,5q_0 = 1, 3, 5, a Chebyshev iteration for denominators of up to about 12 bits at 30000 bits and more at higher precision), the value is computed as an algebraic number by mp_real_sin_cos_pi_ui_div_ui resp. mp_real_tan_pi_ui_div_ui, or, below 12288 bits and from a precision growing with the number of half-angle steps, for the square roots by arb_sqrt; otherwise symmetries reduce xx exactly to [0,1/4][0, 1/4] and the functions of πx\pi x are evaluated there. See Sines and cosines of rational multiples of π.

Cite this page

The FLINT team, “arb_sin_cos_pi_fmpq, arb_sin_pi_fmpq, arb_cos_pi_fmpq, arb_tan_pi_fmpq (arb.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/arb/arb_sin_cos_pi_fmpq.html (generated 2026-11-20).