floating point - float error occured in CPU calculation -
i found strange results in float assignment in cpu
my code is
float w[0]=0.1; printf("%.10f",w[0]);
the result 0.1000000015
can give me help?
thank you.
0.1 decimal repeating 'bicimal': 0.0 0011 0011 0011 0011 0011 0011 0011 ... (the 0011 repeats, i've shown spaces). rounded 24 significant bits -- fit float -- 0.000110011001100110011001101. 0.100000001490116119384765625 in decimal. rounded 10 places, decimal number 0.1000000015 .
Comments
Post a Comment