Here you can find the source of assertApproxEquals(double a, double b, double relative, double absolute)
public static void assertApproxEquals(double a, double b, double relative, double absolute)
//package com.java2s; //License from project: Open Source License public class Main { public static void assertApproxEquals(double a, double b, double relative, double absolute, String message) { double diff = Math.abs(a - b); if (absolute >= 0 && diff <= absolute) return; double rel = diff / Math.max(a, b); if (relative >= 0 && rel <= relative) return; throw new AssertionError("two numbers are not equal enough: " + a + "!= " + b + ", rel=" + rel + ">" + relative + ", abs=" + diff + ">" + absolute + (message != null ? " (" + message + ")" : "")); }// ww w .j a v a2s .com public static void assertApproxEquals(double a, double b, double relative, double absolute) { assertApproxEquals(a, b, relative, absolute, null); } }