Yeah, it worked (at least for %a):
static assert(format!"%.3a"(1.0f) == "0x1.000p+0");
On Thursday, 12 December 2019 at 19:39:16 UTC, Petar Kirov
[ZombineDev] wrote:
You can use a C-style pointer reinterpret cast like this:
uint test(float f) { return *cast(uint*)&f; }
Make sure that source and destination types have the same size.
Hey, great! :-)
On Thursday, 12 December 2019 at 19:21:22 UTC, berni44 wrote:
Is it possible to get to the bits of a float in CTFE? I tried
the following, but this doesn't work:
```
import std.stdio;
union FloatBits
{
float floatValue;
ulong ulongValue;
}
ulong test(float f)
{
FloatBits fb;
f
Is it possible to get to the bits of a float in CTFE? I tried the
following, but this doesn't work:
```
import std.stdio;
union FloatBits
{
float floatValue;
ulong ulongValue;
}
ulong test(float f)
{
FloatBits fb;
fb.floatValue = f;
return fb.ulongValue;
}
void main()
{