Re: ieee754 -0.0f?

Brian Hook <[email protected]> Wed, 1 Feb 2006 12:49:02 -0500
Newsgroups gmane.games.devel.general
Message-ID <20062112492.008414@GATEWAY>
On Wed, 01 Feb 2006 09:50:00 -0700, Andras Balogh wrote:
> I know that -0.0f == +0.0f is true, but the floating point
> representation of the two numbers should be different, no?

They are different, on an IEEE compliant system.  IEEE-754 has the 
high bit reserved for sign, such that on a 32-bit system you would 
have:

-0.0 = 0xbf800000
+0.0 = 0x3f800000

> Shouldn't the negative zero have the sign bit set? Well, on my
> machine -0.0 and 0.0 are bitwise equal!! What's going on here?

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.

Brian




-------------------------------------------------------
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&kid3432&bid#0486&dat1642
_______________________________________________
Gamedevlists-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gamedevlists-general
Archives:
http://sourceforge.net/mailarchive/forum.php?forum_idU7