This is a very strange javascript behaviour, anyone can explain that ?
for(var i=0; i < 0.2 ; i += 0.05)
{
console.log(i);
}
Return in console :
0
0.05
0.1
0.15000000000000002
0.15000000000000002 ?
What is this ?
This is a very strange javascript behaviour, anyone can explain that ?
for(var i=0; i < 0.2 ; i += 0.05)
{
console.log(i);
}
Return in console :
0
0.05
0.1
0.15000000000000002
0.15000000000000002 ?
What is this ?
You should read about floating point numbers. http://en.wikipedia.org/wiki/Floating_point
Also, there are some nice answers here: How to deal with floating point number precision in JavaScript?