Re: [GD-General] ieee754 -0.0f?
Brought to you by:
vexxed72
From: Ash H. <hen...@gm...> - 2006-02-01 20:18:32
|
Peter's earlier message with the union reminded me of some old, (horribly non portable) code I had lying around. Marginally useful for fiddling with float values, but mostly just a peculiarity. Scary :) union __float { struct { unsigned m_mantissa : 24; unsigned m_exponent : 7; unsigned m_sign : 1; }; int m_int; unsigned int m_uint; float m_float; // -- a few implicit conversions __float(float _f) { m_float =3D _f; } __float(int _i) { m_int =3D _i; } __float(unsigned int _i) { m_uint =3D _i; } }; #ifdef _DEBUG #define float __float #endif int _tmain(int argc, _TCHAR* argv[]) { float f =3D 0; /* -- can set in VC debugger; the one I have here you can at least f.m_sign =3D 1; f.m_exponent =3D 0; f.m_mantissa =3D 0; */ void* p =3D *(reinterpret_cast<void**>(&f)); ::printf("%.16e =3D %p\n", f.m_float, p); return 0; }; -- Ash. On 2/1/06, Andras Balogh <and...@gm...> wrote: > > > Notice in my previous post that I did "float b =3D 0.0f/-1.0f" ? > > Yep, I did, and already answered that, it's just that the turnaround of > this mailing list is somewhat slow, so we are always one post behind :) > > > > andras > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through log > files > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D103432&bid=3D230486&dat= =3D121642 > _______________________________________________ > Gamedevlists-general mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-general > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_id=3D557 > |