Re: Float values are wrong in union

2016-08-29 Thread Basile B. via Digitalmars-d-learn
On Monday, 22 August 2016 at 18:19:52 UTC, Engine Machine wrote: On Monday, 22 August 2016 at 05:02:41 UTC, jkpl wrote: On Monday, 22 August 2016 at 04:52:40 UTC, Cauterite wrote: [...] That's a 32 bit codegen issue then because DMD64 's disasm shows that SSE regs are used: x86 give 7FF

Re: Float values are wrong in union

2016-08-22 Thread Engine Machine via Digitalmars-d-learn
On Monday, 22 August 2016 at 05:02:41 UTC, jkpl wrote: On Monday, 22 August 2016 at 04:52:40 UTC, Cauterite wrote: [...] That's a 32 bit codegen issue then because DMD64 's disasm shows that SSE regs are used: void foo() { union test { int i; float f; } test t = { i :

Re: Float values are wrong in union

2016-08-21 Thread jkpl via Digitalmars-d-learn
On Monday, 22 August 2016 at 04:52:40 UTC, Cauterite wrote: On Monday, 22 August 2016 at 04:37:50 UTC, stunaep wrote: I made a union to convert between int bits and floats, but the values are coming out wrong sometimes. I can already tell what this is going to be... The problem is almost

Re: Float values are wrong in union

2016-08-21 Thread Cauterite via Digitalmars-d-learn
On Monday, 22 August 2016 at 04:37:50 UTC, stunaep wrote: I made a union to convert between int bits and floats, but the values are coming out wrong sometimes. I can already tell what this is going to be... The problem is almost certainly nothing to do with your union, it's this line: float

Re: Float values are wrong in union

2016-08-21 Thread jkpl via Digitalmars-d-learn
On Monday, 22 August 2016 at 04:37:50 UTC, stunaep wrote: I made a union to convert between int bits and floats, but the values are coming out wrong sometimes. This is working without issue in other languages so I'm really stumped. Here's an example: union test { int i; float f; } test t =

Float values are wrong in union

2016-08-21 Thread stunaep via Digitalmars-d-learn
I made a union to convert between int bits and floats, but the values are coming out wrong sometimes. This is working without issue in other languages so I'm really stumped. Here's an example: union test { int i; float f; } test t = { i : 0x7fb0}; float t2 = t.f;//int bits 0x7fb0 as