Why are you trying to use the same function to test both int and floating point numbers? You should consider passing the values into your function and either overload the function for use with float, int, char or possibly create a template function.
Number one, you cannot accurately compare floating point values for equality. Subtract one from the other, take the absolute value, and see if the difference is less than your desired error precision.
Number two, never use float unless you have to. Always use longdouble or at the very least double as they are far more precise.