problem while building arm vfp softfloat gcc
Robert Schwebel
robert@schwebel.de
Mon Feb 9 12:33:00 GMT 2004
Dan,
gcc-3.3.2 with glibc-2.3.2 seem to have problems with printf and
floating point anyway. Look at this test case:
----------8<----------
#include <stdio.h>
int main (void)
{
float f = 1.0;
double d = 1.0;
long double ld = 1.0;
printf ("Without cast:\n");
printf ("float:\n");
printf ("f : %f\nlf: %lf\nLf: %Lf\n", f, f, f);
printf ("double:\n");
printf ("f : %f\nlf: %lf\nLf: %Lf\n", d, d, d);
printf ("long double:\n");
printf ("f : %f\nlf: %lf\nLf: %Lf\n", ld, ld, ld);
printf ("With cast:\n");
printf ("float:\n");
printf ("f : %f\nlf: %lf\nLf: %Lf\n", (float) f, (double) f, (long double) f);
printf ("double:\n");
printf ("f : %f\nlf: %lf\nLf: %Lf\n", (float) d, (double) d, (long double) d);
printf ("long double:\n");
printf ("f : %f\nlf: %lf\nLf: %Lf\n", (float) ld, (double) ld, (long double) ld);
return 0;
}
----------8<----------
Compiled with vanilla Debian gcc-3.3.2 on x86:
$ gcc -W -Wall test.c -o test_float
test.c: In Funktion main:
test.c:11: Warnung: long double Format, double Argument (Argument 4)
test.c:13: Warnung: long double Format, double Argument (Argument 4)
test.c:15: Warnung: double Format, long double Argument (Argument 2)
test.c:15: Warnung: double Format, long double Argument (Argument 3)
$ ./test_float
Without cast:
float:
f : 1.000000
lf: 1.000000
Lf: 0.000000
double:
f : 1.000000
lf: 1.000000
Lf: 0.000000
long double:
f : -0.000000
lf: 0.000000
Lf: 0.000000
With cast:
float:
f : 1.000000
lf: 1.000000
Lf: 1.000000
double:
f : 1.000000
lf: 1.000000
Lf: 1.000000
long double:
f : 1.000000
lf: 1.000000
Lf: 1.000000
Nice ;-)
Robert
--
Dipl.-Ing. Robert Schwebel | http://www.pengutronix.de
Pengutronix - Linux Solutions for Science and Industry
Handelsregister: Amtsgericht Hildesheim, HRA 2686
HornemannstraÃe 12, 31137 Hildesheim, Germany
Phone: +49-5121-28619-0 | Fax: +49-5121-28619-4
------
Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com
More information about the crossgcc
mailing list