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 -\pi < \operatorname{Im}(\log x) \le \pi. In the generic case the result is the generator of \mathbb{Q}(\log x).

The following simplifications are made automatically: \log 1 = 0; \log(e^z) = z + 2 \pi i k, \log(\sqrt{z}) = \frac{1}{2} \log z + 2 \pi i k and \log(z^a) = a \log z + 2 \pi i k with the integer k determined numerically; \log x = \log(-x) + \pi i for negative real x; and logarithms of roots of unity are rational multiples of \pi i. Integer relations between logarithms in one field, such as \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 = -\infty (Unknown if it cannot be decided whether x = 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-10-20).