Here you can find the source of almostEqual(double a, double b, double delta)
Parameter | Description |
---|---|
a | First value |
b | Second value |
delta | Precision |
public static boolean almostEqual(double a, double b, double delta)
//package com.java2s; //License from project: Open Source License public class Main { /**/* w ww . ja v a 2 s . c o m*/ * Check whether two floating point values match with a given precision. * * @param a First value * @param b Second value * @param delta Precision * @return {@code true} if the difference of <i>a</i> and <b>b</b> is * smaller or equal than <i>delta</i>, otherwise {@code false} */ public static boolean almostEqual(double a, double b, double delta) { return Math.abs(a - b) <= delta; } }