public static double dmod_d(double lhs,double rhs){
  return rhs != 0 ? lhs - rhs * Math.floor(lhs / rhs) : Double.NaN;
}

public static double dmod_d ( double lhs , double rhs ) { return rhs != 0 ? lhs - rhs * Math . floor ( lhs / rhs ) : Double . NaN ; }
take modulo for double numbers according to lua math , and return a double result .
