question: public static boolean same ( double d1 , double d2 ) { if ( Double . isNaN ( d1 ) ) { return Double . isNaN ( d2 ) ; } if ( d1 == d2 ) return true ; if ( Double . isInfinite ( d1 ) ) { return false ; } return value ( d1 - d2 ) == 0 ; }
target:  When value won't work, because numbers are potentially infinite, then use this one. <p> Standard means for comparing double when dealing with the special quantities, NaN and infinite numbers. Also properly ensures that numbers "close to zero" (within an epsilon) are to be treated as zero for this computation.