a way to specily floating-point numbers as bit patters

Basile B. via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jun 9 10:20:22 PDT 2017


On Friday, 9 June 2017 at 17:18:43 UTC, ketmar wrote:
> Basile B. wrote:
>
>>      enum binFloat = *cast(float*) &b;
>
> i was SO sure that this won't work in CTFE that i didn't even 
> tried to do it. "it will fail anyway, there is no reason in 
> trying!" ;-)

You can do the arithmetic as well. I don't know why but i 
supposed that my static asserts were a proof of CTFE-ability.


More information about the Digitalmars-d-learn mailing list