This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Is this specific to cygwin or gcc?


Hello,

I am using cygwin 1.3.1 with gcc 2.95.3.  In the simple c program below, 
there seems to be a bug in gcc when using floats.  There is a factor of 10.

I asked a friend in Canada to check this on Borland.  She replied she got 
everything to work fine and the second result is 8.5 not 85.0 as I am 
getting from cygwin gcc.

Any hints as to what is happening?

Thanks,

George

---

main()
{   double a, b, c;

      printf("\nEnter a --> ");
      scanf("%lf", &a);

      printf("\nEnter b --> ");
      scanf("%lf", &b);

	c = (a + b) / 2.;
	printf("a is %lf,", a);
	printf(" and b is %lf\n", b);
	printf("The average is %lf\n", c);
}


Enter a --> 6

Enter b --> 7
a is 6.000000, and b is 7.000000
The average is 6.500000


Enter a --> 6.5

Enter b --> 8.5
a is 65.000000, and b is 85.000000
The average is 75.000000


--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]