Here you can find the source of almostEquals(double d1, double d2)
public static final boolean almostEquals(double d1, double d2)
//package com.java2s; //License from project: Apache License public class Main { public static final double EPSILON = 10e-15; public static final boolean almostEquals(double d1, double d2) { return (d1 == 0 && d2 == 0) || Math.abs((d1 / d2) - 1) < EPSILON; }//from w w w . j a va 2 s . co m }