The OpenD Programming Language

ldexp

Compute n * 2exp References: frexp

  1. real ldexp(real n, int exp)
  2. double ldexp(double n, int exp)
  3. float ldexp(float n, int exp)
    pragma(inline, true) @safe pure nothrow @nogc
    float
    ldexp
    (
    float n
    ,
    int exp
    )

Examples

import std.meta : AliasSeq;
static foreach (T; AliasSeq!(float, double, real))
{{
    T r;

    r = ldexp(3.0L, 3);
    assert(r == 24);

    r = ldexp(cast(T) 3.0, cast(int) 3);
    assert(r == 24);

    T n = 3.0;
    int exp = 3;
    r = ldexp(n, exp);
    assert(r == 24);
}}

Meta