Boost logo

Boost Users :

From: John Maddock (john_at_[hidden])
Date: 2008-04-23 13:20:28


Rainer Thaden wrote:
>> If you're happy to use SVN Trunk, then you might want to take a look
>> at the trunc and round family of functions here:
>> http://svn.boost.org/svn/boost/trunk/libs/math/doc/sf_and_dist/html/math_toolkit/special/rounding.html
>
>
> Thanks John. From your answer I read that it doesn't seem to be
> possible to tell numeric_cast to return the nearest integer, right?

That I don't know, but you'd have to customise it for sure, where as these
dedicated rounding functions are intended to do just what they say out of
the box :-)

> So I'd have to round the floating point type to the nearest integer
> with iround and catch rounding errors instead of the exceptions
> numeric_cast throws?

Yep.

John.


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