D
diegotorquemada
Hello,
Probably this is not the right place to ask, but anyway I will post my question.
Why does this code:
#include <stdio.h>
int main(void)
{
int i = 16777217;
float f = 16777217.0;
printf("El entero es: %d\n", i);
printf("El real es: %f\n", f);
printf("Son iguales: %d\n", i == f);
return 0;
}
Returns the following result?
diego@earendil:~/programas$ gcc -Wall -o prog prog.c
diego@earendil:~/programas$ ./prog
El entero es: 16777217
El real es: 16777216.000000 *** IT IS NOT 16777217.0 !!!!***
Son iguales: 0
diego@earendil:~/programas$
My gcc version:
diego@earendil:~/programas$ gcc --version
gcc (Debian 4.3.2-1.1) 4.3.2
Regards,
Diego Andr?s
Probably this is not the right place to ask, but anyway I will post my question.
Why does this code:
#include <stdio.h>
int main(void)
{
int i = 16777217;
float f = 16777217.0;
printf("El entero es: %d\n", i);
printf("El real es: %f\n", f);
printf("Son iguales: %d\n", i == f);
return 0;
}
Returns the following result?
diego@earendil:~/programas$ gcc -Wall -o prog prog.c
diego@earendil:~/programas$ ./prog
El entero es: 16777217
El real es: 16777216.000000 *** IT IS NOT 16777217.0 !!!!***
Son iguales: 0
diego@earendil:~/programas$
My gcc version:
diego@earendil:~/programas$ gcc --version
gcc (Debian 4.3.2-1.1) 4.3.2
Regards,
Diego Andr?s