The OpenD Programming Language

ldexp

@nogc @trusted pure nothrow
T
ldexp
(
T
)
(
const T n
,
int exp
)
if (
isFloatingPoint!T
)

Return Value

Type: T

n * 2exp

Examples

import std.meta : AliasSeq;
static foreach (T; AliasSeq!(float, double, real))
{{
    T 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);
}}

See Also

$(LERF frexp)

Meta