The equals (==) operator can do that for you.
In C, you'd have the following code:
#include <stdio.h>
int main()
{
float f1 = 3.14f;
float f2 = 3.0f;
if (f1 == f2)
printf("The two floats are equal.");
else
printf("The two floats are different.");
return 0;
}