Re: ieee754 -0.0f?

Jim Tilander <[email protected]> Wed, 1 Feb 2006 10:50:46 -0800
Newsgroups gmane.games.devel.general
Message-ID <[email protected]>
Andreas,

Seems like the visual compiler tries to be smart when you say "float b = -
0.0f;", the outputed assembly looks like this:

mov    DWORD PTR _b$[ebp], 0

Notice in my previous post that I did "float b = 0.0f/-1.0f" ? That forces
the compiler to output:

mov    DWORD PTR _b$[ebp], -2147483648        ; 80000000H

/j

On 2/1/06, Andras Balogh <[email protected]> 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 <[email protected]>
> 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 = 80000000
> > but it falls down how you describe (00000000), with Fast selected.
> >
> > (Turion 64 MSVC8 here).
> >
> > Cheers.
> >
> > -- Ash.
> >
> > On 2/1/06, Andras Balogh <[email protected]> wrote:
> >>
> >> > They are different, on an IEEE compliant system.
> >>
> >> Yeah, I know, that's why I'm surprised! :)
> >>
> >> > -0.0 = 0xbf800000
> >> > +0.0 = 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=lnk&kid=103432&bid=230486&dat=121642
> _______________________________________________
> Gamedevlists-general mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/gamedevlists-general
> Archives:
> http://sourceforge.net/mailarchive/forum.php?forum_id=557
>