_mp_real_neglog_agm, _mp_real_neglog_agm_tune
#include <flint/mp_real.h>Set (y, n) to -\log x for (x, n) in [1/2, 1) by the Sasaki–Kanada AGM formula [SK1982]; err is computed at run time and at most 2. The second function takes the number N of terms of the theta series (0 for the default, 4).
With r = x 2^{-e} and q = r^4,
with \pi/4 and \log 2 from the shared caches and the shift e = \lceil p/(4(N + 1)^2) \rceil for p bits. The cost is O(M(n) \log n) against the O(M(n) \log^2 n) of _mp_real_neglog_newton; with warm caches the two cross over near 7 \cdot 10^5 limbs, and against the table-free exponential the AGM is faster from about 20000 limbs. mp_real_exp_agm uses it.
References#
- [SK1982] T. Sasaki and Y. Kanada. Practically fast multiple-precision evaluation of log(x). Journal of Information Processing 5:4 (1982), 247–250.
The FLINT team, “_mp_real_neglog_agm, _mp_real_neglog_agm_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_neglog_agm.html (generated 2026-10-20).
@misc{flint-doc-mp-real-mp-real-neglog-agm,
author = {{The FLINT team}},
title = {{\_mp\_real\_neglog\_agm, \_mp\_real\_neglog\_agm\_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_neglog_agm.html},
note = {Generated 2026-10-20}
}