bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: support for bitwise comparison of floats


From: Eric Blake
Subject: Re: support for bitwise comparison of floats
Date: Sat, 24 Mar 2007 21:38:37 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.10) Gecko/20070221 Thunderbird/1.5.0.10 Mnenhy/0.7.4.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Bruno Haible on 3/24/2007 7:04 PM:
> Hi,
> 
> How can one distinguish +0.0 and -0.0. printf() needs to be able to do it.
> How can this be done portably? I can see two ways:
>   a) By knowing the bit position of the sign bit.
>   b) By doing a bit-for-bit comparison against +0.0.

You can also assume IEEE rules, and compare against signed infinity:
+0. / 1 => +infinity
- -0. / 1 => -infinity

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGBe6884KuGfSFAYARAliPAJkBDx/l499EKZvJFxigAAYLRTYHGwCfSEPp
viDc1I14TvemUzGehiuOrDY=
=OmMu
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]