Thank you for your reply - I can see that you understand my problem exactly.
I have always been told that a double comparison would be more expensive than an int or a boolean. BUT I just tried a test and found that there was NO DIFFERNCE at all between boolean or double comparison - see code below.
My view that when you check a boolean you are looking at maybe one byte, but considerably more for double. How can processor achieve this in the same time?
Code:
std::clock_t start;
std::clock_t end;
double diff;
int i;
int a = 2;
int b= 3;
bool ba = true;
bool bb = false;
double da = 2.0;
double db = 3.0;
double cc;
string input = "";
printf("Start\n");
start = std::clock();
for (i=0;i<4000000000;i++)
{
if (da==db) //MAKE CHANGES HERE
{
cc = 2.0+i;
da == cc;
}
else
{
cc = 2.0+i;
db = cc;
}
}
end = std::clock();
diff = ( end - start) / (double) CLOCKS_PER_SEC;
printf ("Done[%f]: %f\n",cc,diff);
//getline(cin,input);
return 0;