On Wednesday, 6 December 2023 at 12:38:35 UTC, Nick Treleaven
wrote:
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
On Tuesday, 5 December 2023 at 19:47:38 UTC, confuzzled wrote:
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 o
On 12/6/23 4:47 AM, H. S. Teoh wrote:
On Wed, Dec 06, 2023 at 04:24:51AM +0900, confuzzled via Digitalmars-d-learn
wrote:
[...]
Also, if you don't understand how floating-point in computers work, I
highly recommend reading this:
https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldber
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 un
On Wed, Dec 06, 2023 at 04:24:51AM +0900, confuzzled via Digitalmars-d-learn
wrote:
[...]
> import std.stdio;
> void main()
> {
> F fp;
> fp.lo.writeln; // Why is this not zero? How is this value derived?
> fp.hi.writeln; // expected
> fp.x.writeln; // expected
>
> fp.x =
>
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
Given the following union
union F
{
double x;
struct {
ulong lo;
ulong hi;
}
}
I do not understand the output below. Please clarify.
import std.stdio;
void main()
{
F fp;
fp.lo.writeln; // Why is this not zero? How is this value derived?
fp.hi.writeln; //