Original Post
I just found a really strange behaviour with a floating point variable, that is reproducable (at least the misbehaviour itself). I packed the problem into a code snippet :
#include <iostream>
using namespace std;
void main(void)
{
float test = 0.0;
for (int i = 0;i < 100; i++)
{
test += 0.1;
cout << test << "\n";
}
}
[/CODE]
So, when running, it just adds 0.1 to the variable test.
When i look at the output, everything is fine till the value 7.8.
Instead of 7.8 i see 7.79999, 7.89999, 799999, 8.09999
and then it continues the way, it sould be with 8.1, 8.2 and so on ! Why ??? what does this abnormal behaviour mean ??
In the program, where i discovered this bug, the problem starts at 3.1 and doesnt end...
THX for answers
[edited by - Metzler on September 28, 2002 7:32:31 AM]