Possible Duplicate:
Why is floating point arithmetic in C# imprecise?
Why can't decimal numbers be represented exactly in binary?
I dont understand why, this formula works untill Scrap = 51, Rec Should be 17 but instead is 16.99.
Scrap = int.Parse(textBoxS.Text);
for (counter = 0; counter < Scrap; textBoxRec.Text = Rec.ToString() )
{
if (Rec == (int)Rec + 0.66)
{
Rec = (int)Rec + 1;
counter++;
}
else
{
Rec = Rec + 0.33;
counter++;
}
}