Re: [Boost-bugs] [Boost C++ Libraries] #7905: boost::math::policies::raise_rounding_error returns the wrong min/max values for ignore_error and errno_on_error

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #7905: boost::math::policies::raise_rounding_error returns the wrong min/max values for ignore_error and errno_on_error
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-01-18 23:26:46


#7905: boost::math::policies::raise_rounding_error returns the wrong min/max
values for ignore_error and errno_on_error
---------------------------------+------------------------------------------
  Reporter: benkerby@… | Owner:
      Type: Bugs | Status: new
 Milestone: To Be Determined | Component: None
   Version: Boost 1.52.0 | Severity: Problem
Resolution: | Keywords:
---------------------------------+------------------------------------------

Comment (by benkerby@…):

 Note that the function reads:
 {{{
    // This may or may not do the right thing, but the user asked for the
 error
    // to be ignored so here we go anyway:
    return std::numeric_limits<T>::is_specialized ? (val > 0 ?
 (std::numeric_limits<T>::max)() : -(std::numeric_limits<T>::max)()): val;
 }}}

 but it should read
 {{{
    // This may or may not do the right thing, but the user asked for the
 error
    // to be ignored so here we go anyway:
    return std::numeric_limits<TargetType>::is_specialized ? (val > 0 ?
 (std::numeric_limits<TargetType>::max)() :
 (std::numeric_limits<TargetType>::min)()): val;
 }}}

 Two changes:
 - template specialized on the TargetType
 - return the minimum value rather than the negative version of the max
 value (important for unsigned types)

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/7905#comment:1>
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:11 UTC