I presume your code works according to C language specification. The problem is solely about understanding the nature of floating point numbers. Other than integer and fixed point numbers, they involve a rounding error. In the present case, matching 8.1 is missed by a very small difference. You can visualize by printing the numbers with full resolution.
But there's a simple solution: Never test for equality with float numbers, because it possibly never happens.
By the way, it seem pretty stupid to use float or even double (not actually supported by your compiler and casted to real, I guess) with a tiny PIC12F.