Boost logo

Boost Users :

Subject: [Boost-users] [numeric::convert] RoundNearest?
From: Diederick C. Niehorster (dcnieho_at_[hidden])
Date: 2011-07-03 06:21:41


Dear All,

I have just discovered Boost.NumericConvert, useful and a nice effort!
However, I am missing a RoundNearest function for float to int
conversions, with only RoundEven being provided.

RoundEven of course does exactly what it is described to do, rounding
.5 to 0 and 1.5 to 2, but i'd like the highschool (usual?) behavior of
rounding up when a number exactly in the middle is provided. I can
implement it myself by slightly modifying RoundEven of course, but I
am wondering if I am missing something obvious or whether there is a
good reason why this function is not included?

Thank you very much for any thoughts!

Best,
Dee


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net