The OpenD Programming Language

scalbn

Efficiently calculates x * 2n.

scalbn handles underflow and overflow in the same fashion as the basic arithmetic operators.

Special Values
xscalb(x)
$(PLUSMNINF)$(PLUSMNINF)
±0.0±0.0
  1. real scalbn(real x, int n)
    pragma(inline, true) @safe pure nothrow @nogc
    real
    scalbn
    (
    real x
    ,
    int n
    )
  2. double scalbn(double x, int n)
  3. float scalbn(float x, int n)

Examples

assert(scalbn(0x1.2345678abcdefp0L, 999) == 0x1.2345678abcdefp999L);
assert(scalbn(-real.infinity, 5) == -real.infinity);
assert(scalbn(2.0,10) == 2048.0);
assert(scalbn(2048.0f,-10) == 2.0f);

Meta