Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r52615 - in sandbox/numeric_adaptor: boost/numeric_adaptor libs/numeric_adaptor libs/numeric_adaptor/test
From: bruno.lalande_at_[hidden]
Date: 2009-04-26 17:53:04


Author: bruno.lalande
Date: 2009-04-26 17:53:03 EDT (Sun, 26 Apr 2009)
New Revision: 52615
URL: http://svn.boost.org/trac/boost/changeset/52615

Log:
First integration of the CLN library.
Added:
   sandbox/numeric_adaptor/boost/numeric_adaptor/cln_policy.hpp (contents, props changed)
Text files modified:
   sandbox/numeric_adaptor/boost/numeric_adaptor/gmp_policy.hpp | 2 +-
   sandbox/numeric_adaptor/libs/numeric_adaptor/Jamroot | 4 ++--
   sandbox/numeric_adaptor/libs/numeric_adaptor/test/Jamroot | 3 ++-
   sandbox/numeric_adaptor/libs/numeric_adaptor/test/test_heron.cpp | 5 +++++
   4 files changed, 10 insertions(+), 4 deletions(-)

Added: sandbox/numeric_adaptor/boost/numeric_adaptor/cln_policy.hpp
==============================================================================
--- (empty file)
+++ sandbox/numeric_adaptor/boost/numeric_adaptor/cln_policy.hpp 2009-04-26 17:53:03 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,35 @@
+// Numeric Adaptor Library
+//
+// Copyright Barend Gehrels 2009, Geodan Holding B.V. Amsterdam, the Netherlands.
+// Copyright Bruno Lalande 2009
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+
+#ifndef NUMERIC_ADAPTOR_CLN_POLICY_HPP_
+#define NUMERIC_ADAPTOR_CLN_POLICY_HPP_
+
+
+#include <boost/numeric_adaptor/ieee_policy.hpp>
+#include <cln/cln.h>
+#include <cln/float.h>
+
+
+template <typename ClnType>
+struct cln_policy: ieee_policy<ClnType>
+{
+ static inline void sqrt(ClnType& r, const ClnType& a)
+ {
+ r = cln::sqrt(a);
+ }
+
+template <typename CT>
+ static inline CT big_numeric_cast(const ClnType& b)
+ {
+ return cln::double_approx(b);
+ }
+};
+
+
+#endif

Modified: sandbox/numeric_adaptor/boost/numeric_adaptor/gmp_policy.hpp
==============================================================================
--- sandbox/numeric_adaptor/boost/numeric_adaptor/gmp_policy.hpp (original)
+++ sandbox/numeric_adaptor/boost/numeric_adaptor/gmp_policy.hpp 2009-04-26 17:53:03 EDT (Sun, 26 Apr 2009)
@@ -11,7 +11,7 @@
 #define NUMERIC_ADAPTOR_GMP_POLICY_HPP_
 
 
-#include "gmp.h"
+#include <gmp.h>
 
 
 struct gmp_policy

Modified: sandbox/numeric_adaptor/libs/numeric_adaptor/Jamroot
==============================================================================
--- sandbox/numeric_adaptor/libs/numeric_adaptor/Jamroot (original)
+++ sandbox/numeric_adaptor/libs/numeric_adaptor/Jamroot 2009-04-26 17:53:03 EDT (Sun, 26 Apr 2009)
@@ -1,7 +1,7 @@
 # Boost Numeric Adaptor sample program
 #
-# Copyright Bruno Lalande 2008
-# Copyright Barend Gehrels, Geodan Holding B.V. Amsterdam, the Netherlands.
+# Copyright Bruno Lalande 2009
+# Copyright Barend Gehrels 2009, Geodan Holding B.V. Amsterdam, the Netherlands.
 # Use, modification and distribution is subject to the Boost Software License,
 # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
 # http://www.boost.org/LICENSE_1_0.txt)

Modified: sandbox/numeric_adaptor/libs/numeric_adaptor/test/Jamroot
==============================================================================
--- sandbox/numeric_adaptor/libs/numeric_adaptor/test/Jamroot (original)
+++ sandbox/numeric_adaptor/libs/numeric_adaptor/test/Jamroot 2009-04-26 17:53:03 EDT (Sun, 26 Apr 2009)
@@ -8,8 +8,9 @@
 
 
 lib gmp : : <name>gmp ;
+lib cln : : <name>cln ;
 
-project : requirements <include>../../.. <library>gmp ;
+project : requirements <include>../../.. <library>gmp <library>cln ;
 
 import testing ;
 

Modified: sandbox/numeric_adaptor/libs/numeric_adaptor/test/test_heron.cpp
==============================================================================
--- sandbox/numeric_adaptor/libs/numeric_adaptor/test/test_heron.cpp (original)
+++ sandbox/numeric_adaptor/libs/numeric_adaptor/test/test_heron.cpp 2009-04-26 17:53:03 EDT (Sun, 26 Apr 2009)
@@ -11,6 +11,7 @@
 #include <boost/test/floating_point_comparison.hpp>
 #include <boost/numeric_adaptor/numeric_adaptor.hpp>
 #include <boost/numeric_adaptor/ieee_policy.hpp>
+#include <boost/numeric_adaptor/cln_policy.hpp>
 #include <boost/numeric_adaptor/gmp_policy.hpp>
 
 
@@ -33,6 +34,10 @@
         BOOST_CHECK_CLOSE(heron<ieee_policy<float> >(), 0.0, epsilon);
         BOOST_CHECK_CLOSE(heron<ieee_policy<double> >(), 0.327490532778257, epsilon);
         BOOST_CHECK_CLOSE(heron<ieee_policy<long double> >(), 0.327490459921098, epsilon);
+ //BOOST_CHECK_CLOSE(heron<cln_policy<cln::cl_SF> >(), 0.327490532778257, epsilon);
+ BOOST_CHECK_CLOSE(heron<cln_policy<cln::cl_FF> >(), 0.0, epsilon);
+ BOOST_CHECK_CLOSE(heron<cln_policy<cln::cl_DF> >(), 0.32749053277825713, epsilon);
+ //BOOST_CHECK_CLOSE(heron<cln_policy<cln::cl_LF> >(), 0.0, epsilon);
         BOOST_CHECK_CLOSE(heron<gmp_policy>(), 0.327490459942623, epsilon);
 
         return 0;


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