Wednesday 15 January 2014

java - JUnit assertEqual for doubles with percentage delta -


In juneuit, the whole eclipse takes a delta for doubles which is full but does not have any value Is more than? When one is comparing two major values, then it is possible that due to being round, the error, if any, will result in the last important digit despite the deficit, in such cases does not help in having a full delta No?

This is not difficult and I have written one, but just curious why does not that ceremony in Junket do I miss something?

It depends on the situation. If you have a certain precision in two decimal places you want the delta of 0.5e-2, but if you have unknown precision and you want important digits, then you

  assertEquals (expected, Actual, mathematics .abs (expected) / 1e3);   

The problem with relative error is that it is difficult to know whether it should be relative to the expected, real or the combination of the two.

No comments:

Post a Comment