private double maxIgnoreNaN(double a,double b){
  if (Double.isNaN(a)) {
    return b;
  }
  if (Double.isNaN(b)) {
    return a;
  }
  return Math.max(a,b);
}

private double maxIgnoreNaN ( double a , double b ) { if ( Double . isNaN ( a ) ) { return b ; } if ( Double . isNaN ( b ) ) { return a ; } return Math . max ( a , b ) ; }
a function to find the maximum of two values , but ignoring any double . nan values .
