I have a problem that I don't understand. consider the following code:
double Scale;
char *fmterror;
Scale = strtol(string, &fmterror, 10);
if ( *fmterror != '\0' || Scale == 0.0 )
Scale = 1.0;
else
Scale /= 100;
it was compiled with Builder5 on windows2000 and it gives a "floating point overflow" on the line "Scale /= 100". The debugger shows that Scale = 150 at that point and 150 / 100 seems all right to me.
When I saw this I noticed that the code does do strtol instead of strtod and after changing double Scale into float Scale it worked. double is 8 bytes on this compiler and float 4 bytes, long also 4 bytes.
What could be the problem with this code when Scale is double?