Check if float value is integer
I think you're asking how to find out if a number stored as a float
is an integer. There are a number of techniques. Here's one:
if(fVal == floorf(fVal))
... // do something
Use the floating point remainder function:
if (fmod(fVal, 1.0) == 0.0)
// is integer
or
BOOL isInteger = !fmod(fVal, 1.0);
I believe it's the simplest way to check it:
if( fnum == (int)fnum ) {
//fnum has integer value without decimals
}