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

nearbyint returns always 895



>Submitter-Id:	net
>Originator:	Stefan Karrmann
>Organization:	
>Confidential:	no
>Synopsis:	nearbyint returns always 895
>Severity:	serious
>Priority:	medium
>Category:	c
>Class:		wrong-code
>Release:	3.0.3 (Debian testing/unstable)
>Environment:
System: Linux johann 2.4.21 #2 Sun Aug 17 20:52:39 CEST 2003 i686 unknown
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ./configure --enable-languages=c++
>Description:
	Calling nearbyint returns always 895.0
>How-To-Repeat:
	Compile and run:

#include <math.h>
#include <stdio.h>

void show (double x)
{
   printf("nearbyint(%+.3e) = %d\n", x, (int)(nearbyint(x)));
   if(0.0 == x) return;
   x = -x;
   printf("nearbyint(%+.3e) = %d\n", x, (int)(nearbyint(x)));
   x = 1/x;
   printf("nearbyint(%+.3e) = %d\n", x, (int)(nearbyint(x)));
   x = -x;
   printf("nearbyint(%+.3e) = %d\n", x, (int)(nearbyint(x)));
}

int main ()
{
   show(1.1);
   show(11);
   show(111.1);
}

>Fix:
	



Reply to: