public static double lnFunc(double num){
  if (num <= 0) {
    return 0;
  }
 else {
    if (num < MAX_INT_FOR_CACHE_PLUS_ONE) {
      int n=(int)num;
      if ((double)n == num) {
        return INT_N_LOG_N_CACHE[n];
      }
    }
    return num * Math.log(num);
  }
}

public static double lnFunc ( double num ) { if ( num <= 0 ) { return 0 ; } else { if ( num < MAX_INT_FOR_CACHE_PLUS_ONE ) { int n = ( int ) num ; if ( ( double ) n == num ) { return INT_N_LOG_N_CACHE [ n ] ; } } return num * Math . log ( num ) ; } }
help method for computing entropy .
