Subject: [Boost-bugs] [Boost C++ Libraries] #6047: functions round_cast and trunc_cast
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-10-22 11:48:56
#6047: functions round_cast and trunc_cast
-------------------------------------+--------------------------------------
Reporter: 1czajnik@⦠| Owner: johnmaddock
Type: Feature Requests | Status: new
Milestone: To Be Determined | Component: math
Version: Boost Development Trunk | Severity: Problem
Keywords: |
-------------------------------------+--------------------------------------
The functions are general versions of iround, and alike functions.
{{{
template < class R, class T, class Policy >
inline R round_cast( T const& x, Policy const& pol )
{
BOOST_MATH_STD_USING
T r = boost::math::round(x,pol);
if( r > boost::integer_traits<R>::const_max || r <
boost::integer_traits<R>::const_min )
return static_cast<R>( boost::math::policies::raise_rounding_error(
"cz::ar::round_cast<target_type,%1%>(%1%)", 0, x, pol ) );
return static_cast<R>(r);
}
template < class R, class T >
inline R round_cast( T const& x )
{
return round_cast<R>( x, boost::math::policies::policy<>() );
}
}}}
Analogically for trunc()...
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/6047> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:07 UTC