a.c
void main()
{
static long l = -2L;
static double d = 2.2;
static float f = 2.2;
d /= f;
printf("%ld\n",(l));
printf("%lf\n",d);
printf("%lf\n",(l -= d));
l -= d;
l -= d;
l -= d;
printf("hello 3 times\n");
printf("%ld\n",l);
}
gcc -O0 -g a.c
result:
-2
1.000000
1.000000
hello 3 times
-2
reason:
(gdb) p d
$2 = 0.99999997832558429
(gdb)
l -= d
l convert to double
two double substraction
convert to long