Possible Duplicate:
Mysterious calculation error when multiply by 100
Here is a strange problem that I am facing. I store a value .6 to a float variable. When I multiply it with 100 I am getting wrong answer as 60.000004.Where does this .000004 come from? Here is my code
NSlog(@"%f",self.dataHandler.correctPercentage * 100);
if (self.obj.percentage >= (self.dataHandler.correctPercentage * 100) )
{
//Do something
}
My value stored in self.dataHandler.correctPercentage is .6. But when I NSlog it, I am getting 60.000004. My boundary conditions are going wrong due to this.
Why is this happening?