Java Double Number Almost Equal almostEqual(double[][] a, double[][] b, double delta)

Here you can find the source of almostEqual(double[][] a, double[][] b, double delta)

Description

almost Equal

License

Open Source License

Declaration

public static boolean almostEqual(double[][] a, double[][] b, double delta) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static boolean almostEqual(double[][] a, double[][] b, double delta) {
        if (a.length != b.length)
            return false;
        boolean r = true;
        loop1: for (int i = 0; i < a.length; i++) {
            for (int j = 0; j < a[i].length; j++) {
                double d = Math.abs((a[i][j] - b[i][j]) / b[i][j]);
                if (d > delta) {
                    r = false;//from w w w  . j  a va2s . c  o m
                    break loop1;
                }
            }
        }
        return r;
    }
}

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(final double aDouble, final double otherDouble)
  5. almostEquals(double d1, double d2)
  6. almostEquals(double d1, double d2, double epsilon)
  7. almostEquals(double d1, double d2, double threshold)