round() for float in C++

I need a simple floating point rounding function, thus:

double round(double);

round(0.1) = 0
round(-0.1) = 0
round(-0.9) = -1

I can find ceil() and floor() in the math.h – but not round().

Is it present in the standard C++ library under another name, or is it missing??

23 Answers
23

Leave a Comment