1. ALL floating point values are subject to approximation. There are lots of values that we may think are precies, but when stored in binary form, they form infinite series of decimals, just like 1/3 is 0.3333333333.. in decimal, where 1/3 in base 3 is 0.1 - NOT an infinite series of digits. In binary 0.1 is not possible to describe in a finite number of decimals - it becomes 0.099999999999999999... Depending on EXACTLY what the compiler does when producing the code to compare numbers, it may match constant values that come from somewhere else, etc. But it's also entirely possible that:
Code:
double d = 0.1;
if (d == 0.1)
{
   printf("True\n");
}
actually doesn't print "True" - because of some of the intermediate operations done between the loading of the constant 0.1 and the value held in d.

2. Yes, you obviously start by taking the difference of the two numbers. Once you have a difference, you can do:
a) take the absolute value (using fabs()) to see if it's "close enough" [however that is done].
b) see if it's above or below zero. That will tell you which of the two numbers are greater.

--
Mats