Gentoo Archives: gentoo-science

From: Ertugrul Soeylemez <never@××××××××××.org>
To: gentoo-science@l.g.o
Subject: Re: [gentoo-science] question about signbit
Date: Mon, 24 Oct 2005 07:38:40
In Reply to: [gentoo-science] question about signbit by Darren Dale
Darren Dale <dd55@×××××××.edu> (Sat, 22 Oct 2005 14:16:02 -0400):
> I am trying to track down the source of a bug in the SciPy development branch > which, so far, has only been reported on a Gentoo platform (mine). It > involves the use of the libc math function "signbit". Here is a clip from the > manpage: > > `signbit' is a generic macro which can work on all real floating- > point types. It returns a non-zero value if the value of X has > its sign bit set. > > On my system, SciPy's signbit function reports that the sign bit is not set > for any number, positive or negative. Could someone here help me understand > how to test the libc signbit function? I have to admit I have no experience > with C programming.
Hello Darren, This doesn't have to be a bug. I don't know how SciPy works, but many scientific libraries provide their own number types. In most number encoding schemes (like floating point) the sign of a number is determined by a single bit (the most significant bit of the whole number, for integer types; the most significant bit of the mantissa, for floating point types). The scheme could be totally different for SciPy, so the bit actually reported might be the wrong bit. This is not a bug, but rather a missing feature (signbit() doesn't know the type of the number). 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