[Boost-bugs] [Boost C++ Libraries] #8692: setting mpfr precision uses wrong precision and trashes value

Subject: [Boost-bugs] [Boost C++ Libraries] #8692: setting mpfr precision uses wrong precision and trashes value
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-06-13 15:45:42


#8692: setting mpfr precision uses wrong precision and trashes value
-------------------------------------+----------------------------
 Reporter: claude@… | Owner: johnmaddock
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: multiprecision
  Version: Boost Development Trunk | Severity: Problem
 Keywords: |
-------------------------------------+----------------------------
 http://svn.boost.org/svn/boost/trunk/boost/multiprecision/mpfr.hpp
 Two bugs in boost/multiprecision/mpfr.hpp:920-923

 1. set_prec trashes the value, should use prec_round
 2. precision is converted from bits to digits10, should be from digits10
 to bits

 {{{
 void precision(unsigned digits10) BOOST_NOEXCEPT
 {
   mpfr_set_prec(this->m_data,
 multiprecision::detail::digits2_2_10((digits10)));
 }
 }}}

 should be more like

 {{{
 void precision(unsigned digits10) BOOST_NOEXCEPT
 {
   mpfr_prec_round(this->m_data,
 multiprecision::detail::digits10_2_2((digits10)), GMP_RNDN);
 }
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/8692>
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:13 UTC