I am confused regarding the delta/precision in assertEquals
.
I understand that 0.034
will give me the precision for my division code, as shown below:
public void testDivide() {
assertEquals(3.0, Arithmetic.divide(12.0, 4.0), 0.0);
assertEquals(3.3, Arithmetic.divide(10.0, 3.0), 0.034);
//fail("Not yet implemented");
}
However, I tried to change it to 0.03
, the test failed. On the other hand, when I change it to 0.04
, it succeeded, or even if I change it to 0.034444
and so forth, it will succeed.
May I know what does the number mean, and how do we use it?