question: public static boolean approxEquals ( final double a , final double b , final double tolerance ) { if ( Double . isNaN ( a ) || Double . isNaN ( b ) ) { return false ; } if ( a == b ) { return true ; } if ( Double . isInfinite ( a ) || Double . isInfinite ( b ) ) { return false ; } if ( a >= ( b - tolerance ) && a <= ( b + tolerance ) ) { return true ; } return false ; }
target:  Check if two doubles are equal to within specified tolerance.