_mp_real_exp_diophantine, _mp_real_exp_diophantine_tune, _mp_real_sin_cos_diophantine, _mp_real_sin_cos_diophantine_tune, _mp_real_tan_diophantine, _mp_real_tan_diophantine_tune
#include <flint/mp_real.h>void _mp_real_exp_diophantine_tune(nn_ptr y, ulong * err, nn_srcptr x, slong n, slong num_primes, double max_weight)sourcevoid _mp_real_sin_cos_diophantine(nn_ptr ysin, nn_ptr ycos, ulong * err, nn_srcptr x, slong n)sourcevoid _mp_real_sin_cos_diophantine_tune(nn_ptr ysin, nn_ptr ycos, ulong * err, nn_srcptr x, slong n, slong num_primes, double max_weight)sourcevoid _mp_real_tan_diophantine_tune(nn_ptr res, ulong * err, nn_srcptr x, slong n, slong num_primes, double max_weight)sourceEvaluate \exp(x), \sin x and \cos x (either may be NULL), resp. \tan x for (x, n) in [0, 1) by multi-prime argument reduction [HJ2024]: x minus an integer combination of \log p_j (resp. of \pi/2 and the arguments of Gaussian primes), the reduced function by _mp_real_exp_reduced resp. _mp_real_sin_cos_reduced, and a product by a rational (resp. Gaussian rational) number. Outputs have n + 1 limbs; err is at most 3 for exp and 4 for the others. The _tune versions take the number of primes (2 to 64) and the weight budget of the reduction.
The defaults are 13 primes with a budget equal to the precision in bits for the exponential, and 32 Gaussian primes with four times that budget for the trigonometric functions. The logarithms and angles of the primes are process-wide caches computed by Machin-type formulas. See Multi-prime argument reduction.
Guides#
References#
- [HJ2024] J. van der Hoeven and F. Johansson, "Fast multiple precision exp(x) with precomputations", 2024 IEEE 31st Symposium on Computer Arithmetic (ARITH) (2024), https://hal.science/hal-04454093
The FLINT team, “_mp_real_exp_diophantine, _mp_real_exp_diophantine_tune, _mp_real_sin_cos_diophantine, _mp_real_sin_cos_diophantine_tune, _mp_real_tan_diophantine, _mp_real_tan_diophantine_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_exp_diophantine.html (generated 2026-10-20).
@misc{flint-doc-mp-real-mp-real-exp-diophantine,
author = {{The FLINT team}},
title = {{\_mp\_real\_exp\_diophantine, \_mp\_real\_exp\_diophantine\_tune, \_mp\_real\_sin\_cos\_diophantine, \_mp\_real\_sin\_cos\_diophantine\_tune, \_mp\_real\_tan\_diophantine, \_mp\_real\_tan\_diophantine\_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_exp_diophantine.html},
note = {Generated 2026-10-20}
}