FLINT3.7.0-dev

_mp_real_log_fp, _mp_real_log_fp_huge, _mp_real_log1p_fp

Synopsis#include <flint/mp_real.h>
int _mp_real_log_fp(nn_ptr y, slong * len, slong * ue, ulong * err, nn_srcptr d, slong n, slong e, int base2, slong pb)source
int _mp_real_log_fp_huge(nn_ptr y, slong * len, slong * ue, ulong * err, nn_srcptr d, slong n, nn_srcptr c, slong cn, int cneg, slong pb)source
int _mp_real_log1p_fp(nn_ptr y, slong * len, slong * ue, ulong * err, nn_srcptr d, slong n, slong e, int sgnbit, slong pb)source

The logarithm (base2 = 1: the binary logarithm) of x=(d,n) 2e−n FLINT_BITS>0x = (d, n) \, 2^{e - n \, \mathtt{FLINT\_BITS}} > 0 with ∣e−1∣<2FLINT_BITS−3|e - 1| < 2^{\mathtt{FLINT\_BITS} - 3}: sets Y=(y,len)Y = (y, \mathit{len}) (y needs nk + n + 5 limbs), the radix-2 exponent ue of its unit and err, and returns 1 when log⁡x<0\log x < 0, so that log⁡x=(−1)signY 2ue\log x = (-1)^{\text{sign}} Y \, 2^{\mathit{ue}} within err units (x=1x = 1 gives len = 0). Near 1 the kernel runs at as many more limbs as the cancellation costs (at most nn more), so the result keeps its relative accuracy. _mp_real_log_fp_huge takes a bignum e−1=(−1)cneg(c,cn)e - 1 = (-1)^{\mathit{cneg}} (c, \mathit{cn}) (y needs nk + cn + 3 limbs). _mp_real_log1p_fp is log⁡(1+x)\log(1 + x) for x=(−1)sgnbit(d,n) 2e−n FLINT_BITS>−1x = (-1)^{\mathit{sgnbit}} (d, n) \, 2^{e - n \, \mathtt{FLINT\_BITS}} > -1: for ∣x∣<1/2|x| < 1/2 by the kernel of log⁡(1±s)\log(1 \pm s) at −e-e more bits (y needs nk + 3 - e / FLINT_BITS limbs), otherwise on 1+x1 + x formed exactly, or as log⁡x\log x plus a term below a unit for huge xx.

Cite this page

The FLINT team, “_mp_real_log_fp, _mp_real_log_fp_huge, _mp_real_log1p_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_log_fp.html (generated 2026-11-17).