Como dividir duas ints e obter um Java duplo
/*Now, there are several ways we can try to get precise
double value (where num and denom are int type)*/
//with explicit casting:
double d = (double) num / denom;
double d = ((double) num) / denom;
double d = num / (double) denom;
double d = (double) num / (double) denom;
//but not double d = (double) (num / denom);
//with implicit casting:
double d = num * 1.0 / denom;
double d = num / 1d / denom;
double d = ( num + 0.0 ) / denom;
double d = num; d /= denom;
/*but not double d = num / denom * 1.0;
and not double d = 0.0 + ( num / denom );*/
Muddy Manatee