Java Double Number Almost Equal almostEquals(double d1, double d2)

Here you can find the source of almostEquals(double d1, double d2)

Description

almost Equals

License

Apache License

Declaration

public static final boolean almostEquals(double d1, double d2) 

Method Source Code

//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
}

Related

  1. almost(double a, double b, double prec)
  2. almostEqual(double a, double b)
  3. almostEqual(double a, double b, double delta)
  4. almostEqual(double[][] a, double[][] b, double delta)
  5. almostEqual(final double aDouble, final double otherDouble)
  6. almostEquals(double d1, double d2, double epsilon)
  7. almostEquals(double d1, double d2, double threshold)