Hi,
I have encountered a error when doing floating calculations, using Sourcery cross toolchain 4.5.2, and the GCC argument is "-c -fmessage-length=0 -std=c99 -msoft-float" The example is like following:
Example:
#include <stdio.h>
#include <float.h>
int main(){
double a = 5;
double b = a / ((double)2);
double c = 5 / ((double)2);
printf ("b = %2.6lf\n", b);
printf ("c = %2.6lf\n", c);
return 0;
}
running result:
b = 0.000000
c = 2.500000
I couldn't figure out why floating variable is not working, and this code seems to me is quite OK. So I guess that the fault should lies in somewhere of GCC configuration, but no sure.
Hi everyone. Please kindly help. THanks!