Gentoo Logo
Gentoo Spaceship




Note: Due to technical difficulties, the Archives are currently not up to date. GMANE provides an alternative service for most mailing lists.
c.f. bug 424647
List Archive: gentoo-science
Navigation:
Lists: gentoo-science: < Prev By Thread Next > < Prev By Date Next >
Headers:
To: gentoo-science@g.o
From: Miguel Barao <mjsb@...>
Subject: Re: question about signbit
Date: Thu, 27 Oct 2005 15:24:54 +0100
On Thursday 27 October 2005 13:52, Darren Dale wrote:
>
> Here is another test:
>
> #include <math.h>
> #include <stdio.h>
>
> int main() {
> 	printf("signbit(-1): %d\n", signbit(-1));
> 	printf("isnan(0.0/0): %d\n", isnan(0.0/0));
> 	printf("isinf(1.0/0): %d\n", isinf(1.0/0));
> 	return 0;
> }
>
> which yields:
>
> signbit(-1): -2147483648
> isnan(0.0/0): 1
> isinf(1.0/0): 1
>
> Do you know why signbit doesn't yield 1? 

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).

Miguel
-- 
gentoo-science@g.o mailing list


Replies:
Re: question about signbit
-- Ertugrul Soeylemez
References:
question about signbit
-- Darren Dale
Re: question about signbit
-- Marco Matthies
Re: question about signbit
-- Darren Dale
Navigation:
Lists: gentoo-science: < Prev By Thread Next > < Prev By Date Next >
Previous by thread:
Re: question about signbit
Next by thread:
Re: question about signbit
Previous by date:
Re: question about signbit
Next by date:
Re: question about signbit


Updated Jun 17, 2009

Summary: Archive of the gentoo-science mailing list.

Donate to support our development efforts.

Copyright 2001-2013 Gentoo Foundation, Inc. Questions, Comments? Contact us.