_mp_real_sin_cos_pi_ui_div_ui, _mp_real_sin_cos_pi_ui_div_ui_tune
#include <flint/mp_real.h>void _mp_real_sin_cos_pi_ui_div_ui(nn_ptr ys, nn_ptr yc, ulong * err, ulong p, ulong q, slong n)sourcevoid _mp_real_sin_cos_pi_ui_div_ui_tune(nn_ptr ys, nn_ptr yc, ulong * err, ulong p, ulong q, slong n, int alg, int r)sourceSet (y_s, n + 1) and (y_c, n + 1) (either may be NULL) to \sin(\pi p/q) and \cos(\pi p/q) for q \ge 1 and 0 \le p \le q/2. err is at most 4 for the closed forms and the Chebyshev iteration and the kernel's bound plus 2 (at most 6r + 130, r \le 768) when the sine and cosine kernel is used.
After reduction of the fraction, q \le 2 gives exact values, q = 3, 4, 6 quadratic irrationals from _mp_real_rsqrt_ui_newton, and q = 5, 8, 10, 12 closed forms with square roots from about 12 limbs (24 for q = 8). For denominators up to a precision-dependent bit length (none below 48 limbs, 12 bits at 512 limbs, 48 bits at 65536 limbs, any beyond) the value is refined as a root of a Chebyshev polynomial by a high-order iteration costing O(M(n) \log q); otherwise the kernel of mp_real_sin_cos_bits is applied to \pi p/q. The _tune version takes the algorithm (alg = 0 tuned, 1 kernel, 2 Chebyshev iteration, 3 closed forms) and the order of the iteration (r = 0 for the default 12, at most 16). See Sines of rational multiples of π.
The FLINT team, “_mp_real_sin_cos_pi_ui_div_ui, _mp_real_sin_cos_pi_ui_div_ui_tune (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_pi_ui_div_ui.html (generated 2026-10-20).
@misc{flint-doc-mp-real-mp-real-sin-cos-pi-ui-div-ui,
author = {{The FLINT team}},
title = {{\_mp\_real\_sin\_cos\_pi\_ui\_div\_ui, \_mp\_real\_sin\_cos\_pi\_ui\_div\_ui\_tune (mp\_real.h)}},
howpublished = {FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev},
year = {2026},
url = {https://flintlib.org/doc/mp_real/_mp_real_sin_cos_pi_ui_div_ui.html},
note = {Generated 2026-10-20}
}