Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r85174 - trunk/boost/multiprecision
From: john_at_[hidden]
Date: 2013-07-30 03:57:02


Author: johnmaddock
Date: 2013-07-30 03:57:02 EDT (Tue, 30 Jul 2013)
New Revision: 85174
URL: http://svn.boost.org/trac/boost/changeset/85174

Log:
Round mpfr floats towards zero when converting to an integer to match what built in floats do.

Text files modified:
   trunk/boost/multiprecision/mpfr.hpp | 8 ++++----
   1 files changed, 4 insertions(+), 4 deletions(-)

Modified: trunk/boost/multiprecision/mpfr.hpp
==============================================================================
--- trunk/boost/multiprecision/mpfr.hpp Tue Jul 30 03:50:21 2013 (r85173)
+++ trunk/boost/multiprecision/mpfr.hpp 2013-07-30 03:57:02 EDT (Tue, 30 Jul 2013) (r85174)
@@ -1175,7 +1175,7 @@
    {
       BOOST_THROW_EXCEPTION(std::runtime_error("Could not convert NaN to integer."));
    }
- *result = mpfr_get_ui(val.data(), GMP_RNDN);
+ *result = mpfr_get_ui(val.data(), GMP_RNDZ);
 }
 template <unsigned digits10, mpfr_allocation_type AllocationType>
 inline void eval_convert_to(long* result, const mpfr_float_backend<digits10, AllocationType>& val)
@@ -1184,7 +1184,7 @@
    {
       BOOST_THROW_EXCEPTION(std::runtime_error("Could not convert NaN to integer."));
    }
- *result = mpfr_get_si(val.data(), GMP_RNDN);
+ *result = mpfr_get_si(val.data(), GMP_RNDZ);
 }
 #ifdef _MPFR_H_HAVE_INTMAX_T
 template <unsigned digits10, mpfr_allocation_type AllocationType>
@@ -1194,7 +1194,7 @@
    {
       BOOST_THROW_EXCEPTION(std::runtime_error("Could not convert NaN to integer."));
    }
- *result = mpfr_get_uj(val.data(), GMP_RNDN);
+ *result = mpfr_get_uj(val.data(), GMP_RNDZ);
 }
 template <unsigned digits10, mpfr_allocation_type AllocationType>
 inline void eval_convert_to(long long* result, const mpfr_float_backend<digits10, AllocationType>& val)
@@ -1203,7 +1203,7 @@
    {
       BOOST_THROW_EXCEPTION(std::runtime_error("Could not convert NaN to integer."));
    }
- *result = mpfr_get_sj(val.data(), GMP_RNDN);
+ *result = mpfr_get_sj(val.data(), GMP_RNDZ);
 }
 #endif
 template <unsigned digits10, mpfr_allocation_type AllocationType>


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk