Since you already captured the int/double value in the form of string, why not scan for the decimal point or '.'. If there exists non-zero value character(s) after the decimal point, the string presentation must be a double.
As said before, the string will not contain the '.' character. From what I understand, the captured number is kind of a monetary number, captured without the '.', but it still include 2 decimals (cents).
Checking the last 2 digits might be the more accurate solution, easy enough to implement.
Elrond A chess genius is a human being who focuses vast, little-understood mental gifts and labors on an ultimately trivial human enterprise.
-- George Steiner
Firstly, you cannot use a simple floor() or modf() function. If you do, then 14.99999999999 will be rounded to 14, not 15.
On VC++ 6.0, FLT_MIN is 1.175494351e-38F, which is way too small for your epsilon value.
You might use FLT_EPS, which is 1.192092896e-07F, however you would be better looking at the data and deciding on a suitable epsilon value. You need to consider where the data came from, and how accurate it truely is. If it is only recorded to the nearest 0.1, then an epsilon value of 1.0e-7 is silly.
You might get something like this:
const double epsilon = 0.000001; // choose an appropriate value for this.
double Round(double val)
bool IsInt(double val)
return epsilon > fabs(val-Round(val));