On 12/6/23 4:28 AM, Adam D Ruppe wrote:
On Tuesday, 5 December 2023 at 19:24:51 UTC, confuzzled wrote:
Given the following union

union F
{
    double x;
    struct {
        ulong lo;
        ulong hi;
    }
}

The default value of this would be `double.init`, since the first member of the union is a `double`, which is a kind of NaN. This is non-zero.


Correct. So I expected a NaN output for x. However, I wasn't expecting lo == 13835058055282163712 and hi == 32767 where x is of type real, or lo == 9221120237041090560 and hi = 0 where x is of type double. Based on the default initialization rules, I expected both lo and hi to have a value of zero regardless if x is of type double or real. This is what I'm trying to understand, how are these values derived?

Thanks again,
--confuzzled

Reply via email to