Re: [GD-General] ieee754 -0.0f?
Brought to you by:
vexxed72
From: Jim T. <jim...@gm...> - 2006-02-01 18:50:49
|
Andreas, Seems like the visual compiler tries to be smart when you say "float b =3D = - 0.0f;", the outputed assembly looks like this: mov DWORD PTR _b$[ebp], 0 Notice in my previous post that I did "float b =3D 0.0f/-1.0f" ? That force= s the compiler to output: mov DWORD PTR _b$[ebp], -2147483648 ; 80000000H /j On 2/1/06, Andras Balogh <and...@gm...> wrote: > > Well, I've thought about that too, I'm running in debug mode, no > optimizations and using improved floating point consistency (/Op). Still, > -0.0f gives me 0x00000000.. > > On Wed, 01 Feb 2006 11:15:54 -0700, Ash Henstock <hen...@gm...> > wrote: > > > Hi Andras, > > > > I suspect you've got "Fast" floating point model selected in VS project > > options (check in C++->Code Generation I think). > > Running your code here with Strict or Precise gives: > > -0.000000 =3D 80000000 > > but it falls down how you describe (00000000), with Fast selected. > > > > (Turion 64 MSVC8 here). > > > > Cheers. > > > > -- Ash. > > > > On 2/1/06, Andras Balogh <and...@gm...> wrote: > >> > >> > They are different, on an IEEE compliant system. > >> > >> Yeah, I know, that's why I'm surprised! :) > >> > >> > -0.0 =3D 0xbf800000 > >> > +0.0 =3D 0x3f800000 > >> > >> These are -1.0f and +1.0f, but yeah, I've got the point. > >> > >> > You didn't mention the language or how you're generating those > values. > >> > Using VC6 on a Pentium-M by setting global floats I get the correct > >> > and expected values. > >> > >> VS7.1 running on Athlon64, see source in previous post. > >> > >> > >> thanks, > >> > >> > >> > >> 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 > |