floating point divide

Aziz K. aziz.koeksal at gmail.com
Thu Oct 11 07:45:26 PDT 2012


int n1 = 10, n2 = 2;
float f = (n1+0.0f)/n2;

Casting n1 to float would also work, but I hope the compiler is smart  
enough to optimize away the plus expression.


More information about the Digitalmars-d-learn mailing list