Initializing floating point types with explicit mantisa and exponent

kinke via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jan 17 08:40:57 PST 2017


On Tuesday, 17 January 2017 at 00:08:24 UTC, Nordlöw wrote:
> How do I best initialize a D double to an exact mantissa and 
> exponent representation?
>
> I'm specifically interested in
>
>     2^^i for all i in [min_exp, max_exp]

If it doesn't have to be D ;), it can be as simple as 
`core.stdc.math.ldexp(1, exponent)`. No CTFE though.


More information about the Digitalmars-d-learn mailing list