Thursday, January 21, 2010

Rounding a number without "if"s


Rounding a "double" number without using "if" statements

double num;
int num_rounded = static_cast<int>(floor(num+0.5));

No comments:

Back to Top


 

Labels