Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r83716 - trunk/libs/multiprecision/performance
From: john_at_[hidden]
Date: 2013-04-02 14:11:36


Author: johnmaddock
Date: 2013-04-02 14:11:35 EDT (Tue, 02 Apr 2013)
New Revision: 83716
URL: http://svn.boost.org/trac/boost/changeset/83716

Log:
Fix up linpack tests for __float128
Text files modified:
   trunk/libs/multiprecision/performance/linpack-benchmark.cpp | 31 +++++++++++++++++++++++++++++--
   1 files changed, 29 insertions(+), 2 deletions(-)

Modified: trunk/libs/multiprecision/performance/linpack-benchmark.cpp
==============================================================================
--- trunk/libs/multiprecision/performance/linpack-benchmark.cpp (original)
+++ trunk/libs/multiprecision/performance/linpack-benchmark.cpp 2013-04-02 14:11:35 EDT (Tue, 02 Apr 2013)
@@ -14,7 +14,6 @@
 
 http://www.netlib.org/f2c/libf2c.zip
 */
-#include <boost/lexical_cast.hpp>
 #include <iostream>
 #include <iomanip>
 #include <cmath>
@@ -34,10 +33,37 @@
 #elif defined(TEST_MPF_50)
 #include <boost/multiprecision/gmp.hpp>
 typedef boost::multiprecision::mpf_float_50 real_type;
+#elif defined(NATIVE_FLOAT128)
+#include <boost/multiprecision/float128.hpp>
+typedef __float128 real_type;
+
+std::ostream& operator<<(std::ostream& os, const __float128& f)
+{
+ return os << boost::multiprecision::float128(f);
+}
+
+#include <boost/type_traits/has_left_shift.hpp>
+
+namespace boost{
+
+template<>
+struct has_left_shift<std::basic_ostream<char>, __float128> : public mpl::true_ {};
+
+template<>
+double lexical_cast<double, __float128>(const __float128& f)
+{ return f; }
+
+}
+
+#elif defined(TEST_FLOAT128)
+#include <boost/multiprecision/float128.hpp>
+typedef boost::multiprecision::float128 real_type;
 #else
 typedef double real_type;
 #endif
 
+#include <boost/lexical_cast.hpp>
+
 #ifndef CAST_TO_RT
 # define CAST_TO_RT(x) x
 #endif
@@ -87,7 +113,6 @@
 int daxpy_(integer *, real_type *, real_type *, integer *, real_type *, integer *);
 int dmxpy_(integer *, real_type *, integer *, integer *, real_type *, real_type *);
 
-
 extern "C" int MAIN__()
 {
 #ifdef TEST_MPF_50
@@ -911,6 +936,8 @@
    return std::ldexp(1.0, 1 - ((100 + 1) * 1000L) / 301L);
 #elif defined(TEST_CPP_DEC_FLOAT_BN)
    return std::pow(10.0, 1-std::numeric_limits<efx::cpp_dec_float_50>::digits10);
+#elif defined(NATIVE_FLOAT128)
+ return FLT128_EPSILON;
 #else
    return CAST_TO_RT(std::numeric_limits<real_type>::epsilon());
 #endif


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