Alex Rivera | Logout

Where is Round() in C++?

Asked 2009-02-16T19:01:57.130
38

Duplicate of: round() for float in C++


I'm using VS2008 and I've included math.h but I still can't find a round function. Does it exist?

I'm seeing a bunch of "add 0.5 and cast to int" solutions on google. Is that the best practice?

Edit
Report

1 Answer

0

I don't know if it's best practice or not but using the 0.5 technique with a floor() seems to be the way to go.

answered 2009-02-16T19:08:51.293

Your Answer