java floating point comparison

I am doing numerical analysis in Java. Due to all the arithmetic including the use of rounding functions, I often end up with floating point numbers such as 29.400000000000002 or 0.00000000001. I often need to compare such numbers for equality which fails because of the error induced.

How do I compare these numbers? I tried using an epsilon such as

if (Math.abs(a-b) <= EPISLON) { }

but the problem is that the EPSILON is variable and does not always work..

thank you,

Sam