I have 2 doubles x and y. When I divide x/y I dont get the result I am hoping to get.
Here is the printf command I am using in c and the output I am getting:
command:
printf("%3.10f %3.2f %3.12f %d\n",x,y,x/y,(int)(x/y));
output:
1.0000000000 0.10 10.000000000000 9
To me, x/y ought to be 10 and so not sure why (int)(x/y) is producing 9 instead of 10.
Can someone help me understand this surce of this problem please?