question: public static void assertEqualsWithRelativeErrorOrBothNaN ( String message , double expected , double actual ) { if ( expected == actual ) { return ; } if ( Double . isNaN ( expected ) && ! Double . isNaN ( actual ) ) { throw new AssertionFailedError ( message + " expected: <" + expected + "> but was: <" + actual + ">" ) ; } if ( ! Double . isNaN ( expected ) && Double . isNaN ( actual ) ) { throw new AssertionFailedError ( message + " expected: <" + expected + "> but was: <" + actual + ">" ) ; } double relativeError ; if ( Math . abs ( actual ) > Math . abs ( expected ) ) { relativeError = Math . abs ( ( expected - actual ) / actual ) ; } else { relativeError = Math . abs ( ( expected - actual ) / expected ) ; } if ( relativeError > MAX_RELATIVE_ERROR ) { throw new AssertionFailedError ( message + " expected: <" + expected + "> but was: <" + actual + ">" ) ; } }
target:  Attention: Does not work with values near 0!!