delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/05/17/19:40:57

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-ID: <01C0DF3C.41B4E5A0@george.wakileh@vol.at>
From: "George J. Wakileh" <george DOT wakileh AT vol DOT at>
To: "'cygwin AT cygwin DOT com'" <cygwin AT cygwin DOT com>
Subject: Is this specific to cygwin or gcc?
Date: Fri, 18 May 2001 01:45:41 +0200
X-Mailer: Microsoft Internet E-mail/MAPI - 8.0.0.4025
MIME-Version: 1.0

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019