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

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -