union test { int i; float f; } test t = { i : 0x7fb00000}; float t2 = t.f;//int bits 0x7fb00000 as float test t3 = { f : t2 }; writefln("%x", t3.i);//prints 7ff00000 NOT 0x7fb00000
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:
- Float values are wrong in union stunaep via Digitalmars-d-learn
- Re: Float values are wrong in ... jkpl via Digitalmars-d-learn
- Re: Float values are wrong in ... Cauterite via Digitalmars-d-learn
- Re: Float values are wrong... jkpl via Digitalmars-d-learn
- Re: Float values are w... Engine Machine via Digitalmars-d-learn
- Re: Float values a... Basile B. via Digitalmars-d-learn