FLINT3.7.0-dev

ca_log

Synopsis#include <flint/ca.h>
void ca_log(ca_t res, const ca_t x, ca_ctx_t ctx)source

Sets res to the principal branch of the natural logarithm, with −π<Im⁡(log⁡x)≤π-\pi < \operatorname{Im}(\log x) \le \pi. In the generic case the result is the generator of Q(log⁡x)\mathbb{Q}(\log x).

The following simplifications are made automatically: log⁡1=0\log 1 = 0; log⁡(ez)=z+2πik\log(e^z) = z + 2 \pi i k, log⁡(z)=12log⁡z+2πik\log(\sqrt{z}) = \frac{1}{2} \log z + 2 \pi i k and log⁡(za)=alog⁡z+2πik\log(z^a) = a \log z + 2 \pi i k with the integer kk determined numerically; log⁡x=log⁡(−x)+πi\log x = \log(-x) + \pi i for negative real xx; and logarithms of roots of unity are rational multiples of πi\pi i. Integer relations between logarithms in one field, such as log⁡8=3log⁡2\log 8 = 3 \log 2, are found when the field is created (see Formal fields and the ideal of relations).

For special values and zero, log⁡0=−∞\log 0 = -\infty (Unknown if it cannot be decided whether x=0x = 0), the logarithm of any infinity is +∞+\infty, and Undefined and Unknown map to themselves.

Guides#

Cite this page

The FLINT team, “ca_log (ca.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/ca/ca_log.html (generated 2026-11-02).