|
Boost-Commit : |
From: john_at_[hidden]
Date: 2008-05-19 14:03:10
Author: johnmaddock
Date: 2008-05-19 14:03:09 EDT (Mon, 19 May 2008)
New Revision: 45550
URL: http://svn.boost.org/trac/boost/changeset/45550
Log:
Rename some of the extern "C" C99 functions so we don't get infinite recursion.
Disabled long double testing when not available.
Text files modified:
trunk/boost/math/tr1.hpp | 36 +++++++++++++++++++++++++++---------
trunk/libs/math/src/tr1/expm1.cpp | 2 +-
trunk/libs/math/src/tr1/expm1f.cpp | 2 +-
trunk/libs/math/src/tr1/expm1l.cpp | 2 +-
trunk/libs/math/src/tr1/log1p.cpp | 2 +-
trunk/libs/math/src/tr1/log1pf.cpp | 2 +-
trunk/libs/math/src/tr1/log1pl.cpp | 2 +-
trunk/libs/math/src/tr1/nextafter.cpp | 2 +-
trunk/libs/math/src/tr1/nextafterf.cpp | 2 +-
trunk/libs/math/src/tr1/nextafterl.cpp | 2 +-
trunk/libs/math/test/test_next.cpp | 2 ++
trunk/libs/math/test/test_tr1.cpp | 4 ++++
12 files changed, 42 insertions(+), 18 deletions(-)
Modified: trunk/boost/math/tr1.hpp
==============================================================================
--- trunk/boost/math/tr1.hpp (original)
+++ trunk/boost/math/tr1.hpp 2008-05-19 14:03:09 EDT (Mon, 19 May 2008)
@@ -140,9 +140,9 @@
float BOOST_MATH_TR1_DECL exp2f(float x);
long double BOOST_MATH_TR1_DECL exp2l(long double x);
#endif
-double BOOST_MATH_TR1_DECL expm1(double x);
-float BOOST_MATH_TR1_DECL expm1f(float x);
-long double BOOST_MATH_TR1_DECL expm1l(long double x);
+double BOOST_MATH_TR1_DECL boost_expm1(double x);
+float BOOST_MATH_TR1_DECL boost_expm1f(float x);
+long double BOOST_MATH_TR1_DECL boost_expm1l(long double x);
#if 0
double BOOST_MATH_TR1_DECL fdim(double x, double y);
float BOOST_MATH_TR1_DECL fdimf(float x, float y);
@@ -179,9 +179,9 @@
long long BOOST_MATH_TR1_DECL llroundf(float x);
long long BOOST_MATH_TR1_DECL llroundl(long double x);
-double BOOST_MATH_TR1_DECL log1p(double x);
-float BOOST_MATH_TR1_DECL log1pf(float x);
-long double BOOST_MATH_TR1_DECL log1pl(long double x);
+double BOOST_MATH_TR1_DECL boost_log1p(double x);
+float BOOST_MATH_TR1_DECL boost_log1pf(float x);
+long double BOOST_MATH_TR1_DECL boost_log1pl(long double x);
#if 0
double BOOST_MATH_TR1_DECL log2(double x);
float BOOST_MATH_TR1_DECL log2f(float x);
@@ -205,9 +205,9 @@
float BOOST_MATH_TR1_DECL nearbyintf(float x);
long double BOOST_MATH_TR1_DECL nearbyintl(long double x);
#endif
-double BOOST_MATH_TR1_DECL nextafter(double x, double y);
-float BOOST_MATH_TR1_DECL nextafterf(float x, float y);
-long double BOOST_MATH_TR1_DECL nextafterl(long double x, long double y);
+double BOOST_MATH_TR1_DECL boost_nextafter(double x, double y);
+float BOOST_MATH_TR1_DECL boost_nextafterf(float x, float y);
+long double BOOST_MATH_TR1_DECL boost_nextafterl(long double x, long double y);
double BOOST_MATH_TR1_DECL nexttoward(double x, long double y);
float BOOST_MATH_TR1_DECL nexttowardf(float x, long double y);
@@ -430,6 +430,12 @@
float exp2f(float x);
long double exp2l(long double x);
#endif
+inline float expm1f(float x)
+{ return boost::math::tr1::boost_expm1f(x); }
+inline double expm1(double x)
+{ return boost::math::tr1::boost_expm1(x); }
+inline long double expm1l(long double x)
+{ return boost::math::tr1::boost_expm1l(x); }
inline float expm1(float x)
{ return boost::math::tr1::expm1f(x); }
inline long double expm1(long double x)
@@ -493,6 +499,12 @@
inline long long llround(T x)
{ return llround(static_cast<double>(x)); }
+inline float log1pf(float x)
+{ return boost::math::tr1::boost_log1pf(x); }
+inline double log1p(double x)
+{ return boost::math::tr1::boost_log1p(x); }
+inline long double log1pl(long double x)
+{ return boost::math::tr1::boost_log1pl(x); }
inline float log1p(float x)
{ return boost::math::tr1::log1pf(x); }
inline long double log1p(long double x)
@@ -527,6 +539,12 @@
float nearbyintf(float x);
long double nearbyintl(long double x);
#endif
+inline float nextafterf(float x, float y)
+{ return boost::math::tr1::boost_nextafterf(x, y); }
+inline double nextafter(double x, double y)
+{ return boost::math::tr1::boost_nextafter(x, y); }
+inline long double nextafterl(long double x, long double y)
+{ return boost::math::tr1::boost_nextafterl(x, y); }
inline float nextafter(float x, float y)
{ return boost::math::tr1::nextafterf(x, y); }
inline long double nextafter(long double x, long double y)
Modified: trunk/libs/math/src/tr1/expm1.cpp
==============================================================================
--- trunk/libs/math/src/tr1/expm1.cpp (original)
+++ trunk/libs/math/src/tr1/expm1.cpp 2008-05-19 14:03:09 EDT (Mon, 19 May 2008)
@@ -8,7 +8,7 @@
#include <boost/math/special_functions/expm1.hpp>
#include "c_policy.hpp"
-extern "C" double BOOST_MATH_TR1_DECL expm1(double x)
+extern "C" double BOOST_MATH_TR1_DECL boost_expm1(double x)
{
return c_policies::expm1(x);
}
Modified: trunk/libs/math/src/tr1/expm1f.cpp
==============================================================================
--- trunk/libs/math/src/tr1/expm1f.cpp (original)
+++ trunk/libs/math/src/tr1/expm1f.cpp 2008-05-19 14:03:09 EDT (Mon, 19 May 2008)
@@ -8,7 +8,7 @@
#include <boost/math/special_functions/expm1.hpp>
#include "c_policy.hpp"
-extern "C" float BOOST_MATH_TR1_DECL expm1f(float x)
+extern "C" float BOOST_MATH_TR1_DECL boost_expm1f(float x)
{
return c_policies::expm1(x);
}
Modified: trunk/libs/math/src/tr1/expm1l.cpp
==============================================================================
--- trunk/libs/math/src/tr1/expm1l.cpp (original)
+++ trunk/libs/math/src/tr1/expm1l.cpp 2008-05-19 14:03:09 EDT (Mon, 19 May 2008)
@@ -8,7 +8,7 @@
#include <boost/math/special_functions/expm1.hpp>
#include "c_policy.hpp"
-extern "C" long double BOOST_MATH_TR1_DECL expm1l(long double x)
+extern "C" long double BOOST_MATH_TR1_DECL boost_expm1l(long double x)
{
return c_policies::expm1(x);
}
Modified: trunk/libs/math/src/tr1/log1p.cpp
==============================================================================
--- trunk/libs/math/src/tr1/log1p.cpp (original)
+++ trunk/libs/math/src/tr1/log1p.cpp 2008-05-19 14:03:09 EDT (Mon, 19 May 2008)
@@ -10,7 +10,7 @@
namespace boost{ namespace math{ namespace tr1{
-extern "C" double BOOST_MATH_TR1_DECL log1p(double x)
+extern "C" double BOOST_MATH_TR1_DECL boost_log1p(double x)
{
return c_policies::log1p(x);
}
Modified: trunk/libs/math/src/tr1/log1pf.cpp
==============================================================================
--- trunk/libs/math/src/tr1/log1pf.cpp (original)
+++ trunk/libs/math/src/tr1/log1pf.cpp 2008-05-19 14:03:09 EDT (Mon, 19 May 2008)
@@ -10,7 +10,7 @@
namespace boost{ namespace math{ namespace tr1{
-extern "C" float BOOST_MATH_TR1_DECL log1pf(float x)
+extern "C" float BOOST_MATH_TR1_DECL boost_log1pf(float x)
{
return c_policies::log1p(x);
}
Modified: trunk/libs/math/src/tr1/log1pl.cpp
==============================================================================
--- trunk/libs/math/src/tr1/log1pl.cpp (original)
+++ trunk/libs/math/src/tr1/log1pl.cpp 2008-05-19 14:03:09 EDT (Mon, 19 May 2008)
@@ -10,7 +10,7 @@
namespace boost{ namespace math{ namespace tr1{
-extern "C" long double BOOST_MATH_TR1_DECL log1pl(long double x)
+extern "C" long double BOOST_MATH_TR1_DECL boost_log1pl(long double x)
{
return c_policies::log1p(x);
}
Modified: trunk/libs/math/src/tr1/nextafter.cpp
==============================================================================
--- trunk/libs/math/src/tr1/nextafter.cpp (original)
+++ trunk/libs/math/src/tr1/nextafter.cpp 2008-05-19 14:03:09 EDT (Mon, 19 May 2008)
@@ -10,7 +10,7 @@
namespace boost{ namespace math{ namespace tr1{
-extern "C" double BOOST_MATH_TR1_DECL nextafter(double x, double y)
+extern "C" double BOOST_MATH_TR1_DECL boost_nextafter(double x, double y)
{
return c_policies::nextafter(x, y);
}
Modified: trunk/libs/math/src/tr1/nextafterf.cpp
==============================================================================
--- trunk/libs/math/src/tr1/nextafterf.cpp (original)
+++ trunk/libs/math/src/tr1/nextafterf.cpp 2008-05-19 14:03:09 EDT (Mon, 19 May 2008)
@@ -10,7 +10,7 @@
namespace boost{ namespace math{ namespace tr1{
-extern "C" float BOOST_MATH_TR1_DECL nextafterf(float x, float y)
+extern "C" float BOOST_MATH_TR1_DECL boost_nextafterf(float x, float y)
{
return c_policies::nextafter(x, y);
}
Modified: trunk/libs/math/src/tr1/nextafterl.cpp
==============================================================================
--- trunk/libs/math/src/tr1/nextafterl.cpp (original)
+++ trunk/libs/math/src/tr1/nextafterl.cpp 2008-05-19 14:03:09 EDT (Mon, 19 May 2008)
@@ -10,7 +10,7 @@
namespace boost{ namespace math{ namespace tr1{
-extern "C" long double BOOST_MATH_TR1_DECL nextafterl(long double x, long double y)
+extern "C" long double BOOST_MATH_TR1_DECL boost_nextafterl(long double x, long double y)
{
return c_policies::nextafter(x, y);
}
Modified: trunk/libs/math/test/test_next.cpp
==============================================================================
--- trunk/libs/math/test/test_next.cpp (original)
+++ trunk/libs/math/test/test_next.cpp 2008-05-19 14:03:09 EDT (Mon, 19 May 2008)
@@ -109,8 +109,10 @@
{
test_values(1.0f, "float");
test_values(1.0, "double");
+#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
test_values(1.0L, "long double");
test_values(boost::math::concepts::real_concept(0), "real_concept");
+#endif
return 0;
}
Modified: trunk/libs/math/test/test_tr1.cpp
==============================================================================
--- trunk/libs/math/test/test_tr1.cpp (original)
+++ trunk/libs/math/test/test_tr1.cpp 2008-05-19 14:03:09 EDT (Mon, 19 May 2008)
@@ -967,6 +967,7 @@
void test_values(long double, const char* name)
{
+#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
std::cout << "Testing type " << name << std::endl;
long double eps = boost::math::tools::epsilon<long double>();
@@ -1593,13 +1594,16 @@
BOOST_CHECK_CLOSE_FRACTION(tr1::sph_legendre(3L, 2L, static_cast<long double>(0.5L)), static_cast<long double>(0.2061460599687871330692286791802688341213L), eps * 5000L);
BOOST_CHECK_CLOSE_FRACTION(tr1::sph_legendre(40L, 15L, static_cast<long double>(0.75L)), static_cast<long double>(-0.406036847302819452666908966769096223205057182668333862900509L), eps * 5000L);
+#endif
}
int test_main(int, char* [])
{
test_values(1.0f, "float");
test_values(1.0, "double");
+#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
test_values(1.0L, "long double");
+#endif
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