On Tuesday, 17 January 2017 at 17:56:13 UTC, Nordlöw wrote:
On Tuesday, 17 January 2017 at 16:40:57 UTC, kinke wrote:If it doesn't have to be D ;), it can be as simple as `core.stdc.math.ldexp(1, exponent)`. No CTFE though.Isn't it a simple as 2.0^^exponent ?
It should and I looked into that as well, but I didn't like the implementation as loop: https://github.com/dlang/phobos/blob/master/std/math.d#L5988
A special case for base x == 2 wouldn't hurt.