FLINT3.7.0-dev

d_log2

Synopsis#include <flint/double_extras.h>
double d_log2(double x)source

Returns an approximation of \log_2 x, computed as log(x) divided by the double nearest to \log 2, so with an error of a few ulps. The result is not exact for all powers of two: for x = 2^{-1023} it is -1023.0000000000001. Special values and domain errors are those of log.

Cite this page

The FLINT team, “d_log2 (double_extras.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/double_extras/d_log2.html (generated 2026-10-20).