A comparison for strict equality is almost never safe. Instead, use fabs(xy) < EPS , where EPS is a constant, for example, 1e-7 .
The only case where you can afford a strict comparison is if there is some constant that you could assign yourself (obviously, without calculations), and with which you compare in order to find out if there was a reassignment. And even in this place one has to be careful, because there are cases when, due to optimization, the compared values have a different type, which leads to different accuracy and inequality.
All the calculations with integers up to 2 53 are exact. It is used by languages with a single numeric type (for example js). However, if you are sure that the value is an integer, then why bother to use double at all? It is better to take a 64-bit integer type.