d_mul_2exp, d_mul_2exp_inrange, d_mul_2exp_inrange2
#include <flint/double_extras.h>double d_mul_2exp(double x, int i)sourcedouble d_mul_2exp_inrange(double x, int i)sourcedouble d_mul_2exp_inrange2(double x, int i)sourceReturn x \cdot 2^i. The result is exact unless it overflows or is subnormal. d_mul_2exp accepts any i and calls ldexp when 2^i is not a normal double. The other two are faster special cases with unchecked preconditions.
d_mul_2exp_inrange requires -1022 \le i \le 1023. It builds the double 2^i from its bit pattern and performs one multiplication, so overflow, underflow and special values of x behave as for an ordinary multiplication.
d_mul_2exp_inrange2 adds i to the exponent field of x with an integer addition. It additionally requires that x and x \cdot 2^i are normal doubles, in particular x \ne 0; otherwise the result is meaningless. The preconditions of both functions are checked only in builds configured with --enable-assert.
The FLINT team, “d_mul_2exp, d_mul_2exp_inrange, d_mul_2exp_inrange2 (double_extras.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/double_extras/d_mul_2exp.html (generated 2026-10-20).
@misc{flint-doc-double-extras-d-mul-2exp,
author = {{The FLINT team}},
title = {{d\_mul\_2exp, d\_mul\_2exp\_inrange, d\_mul\_2exp\_inrange2 (double\_extras.h)}},
howpublished = {FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev},
year = {2026},
url = {https://flintlib.org/doc/double_extras/d_mul_2exp.html},
note = {Generated 2026-10-20}
}