I found a strange results in the float assignment in CPU
My code is
float W[0]=0.1;
printf("%.10f",W[0]);
The result is 0.1000000015
Can anyone give me a help?
Thank you.
I found a strange results in the float assignment in CPU
My code is
float W[0]=0.1;
printf("%.10f",W[0]);
The result is 0.1000000015
Can anyone give me a help?
Thank you.
0.1 decimal is a repeating 'bicimal': 0.0 0011 0011 0011 0011 0011 0011 0011 ... (the 0011 repeats, which I've shown with spaces). Rounded to 24 significant bits -- to fit into a float -- that is 0.000110011001100110011001101. That is 0.100000001490116119384765625 in decimal. Rounded to 10 places, the decimal number is 0.1000000015 .