This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
for loop: different results on cygwin and on linux
- From: "Lemaitre Laurent-r29173" <Laurent dot Lemaitre at freescale dot com>
- To: <gcc-help at gcc dot gnu dot org>
- Date: Tue, 3 Jul 2007 19:01:21 +0200
- Subject: for loop: different results on cygwin and on linux
Hi All,
Not sure if this is the right place to ask this question.
My apologies if not!
I am trying to build a testsuite that I want to run on different
platforms.
My testsuite uses the printf command and a for-loop. But depending on
the platform
I compile my program my code gives unexpected different results.
Below is an example that illustrates the problem.
$ cat printf.c
#include <stdio.h>
int main(void)
{
double v;
for (v=0.0;v<1.0;v+=0.5)
;
printf("o %-1.6e\n",v);
for (v=1.0;v<1.0;v+=0.1)
;
printf("# %-1.6e\n",v);
return 0;
}
which gives on windows (printf.c compiled using gcc version 3.4.4):
o 1.000000e+000
# 1.000000e+000
and on linux (printf.c compiled using gcc version 3.2.3):
o 1.000000e+00
# 1.100000e+00
Is-there any way to change the code so that I am sure I will get
identical
results on both platforms (cygwin and linux)?
Thanks,
Laurent