FLINT3.7.0-dev

d_mul_2exp, d_mul_2exp_inrange, d_mul_2exp_inrange2

Synopsis#include <flint/double_extras.h>
double d_mul_2exp(double x, int i)source
double d_mul_2exp_inrange(double x, int i)source
double d_mul_2exp_inrange2(double x, int i)source

Return 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.

Cite this page

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).