Gentoo Archives: gentoo-science

From: Ertugrul Soeylemez <never@××××××××××.org>
To: gentoo-science@l.g.o
Subject: Re: [gentoo-science] question about signbit
Date: Fri, 28 Oct 2005 00:28:33
In Reply to: Re: [gentoo-science] question about signbit by Miguel Barao
Miguel Barao <mjsb@×××××××××××××××.pt> (Thu, 27 Oct 2005 15:24:54 +0100):
> The answer is in 'man signbit'. > > signbit is probably just ANDing your float value with 2^31=0x80000000 which > reads -2147483648 if considered as a signed int (like in your printf).
Yes. The manpage doesn't say it returns 1, but it returns non-zero. -2147483648 is non-zero. You need to check if the value is !0, not if the value is 1. By the way, this holds for many boolean functions. Regards. ----- Get my public key via GnuPG with one of: gpg --keyserver --recv-keys CE402012 gpg --keyserver ldap:// --recv-keys CE402012 Or via web-based keyserver: Key fingerprint: 0F12 0912 DFC8 2FC5 E2B8 A23E 6BAC 998E CE40 2012