public boolean hasBadValues() {
        for(int i=0; i<top; i++) {
            double v = vals[i];
            boolean bad = Double.isNaN(v) || Double.isInfinite(v);
            if(bad) return true;
        }
        return false;
    }
public boolean hasBadValues ( ) { for ( int i = 0 ; i < top ; i ++ ) { double v = vals [ i ] ; boolean bad = Double . isNaN ( v ) || Double . isInfinite ( v ) ; if ( bad ) return true ; } return false ; }
returns true if any values are NaN or Inf