[Math] Making math compile on C99 archs with no long double

In trying to compile Boost 1.38.0 for arm/gcc-4.1.2, which has no long double support, I ran into the following compile error: ./boost/math/special_functions/expm1.hpp: In function ‘long double boost::math::expm1(long double, const boost::math::policies::policy<boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy>&)’: ./boost/math/special_functions/expm1.hpp:270: error: ‘::expm1l’ has not been declared The fix is simple - the expm1.hpp is trying to use a long double C99 function despite BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS being defined. The following patch (also attached in case gmail mangles it) fixes the problem: diff -r -u boost_1_38_0.orig/boost/math/special_functions/expm1.hpp boost_1_38_0/boost/math/special_functions/expm1.hpp --- boost_1_38_0.orig/boost/math/special_functions/expm1.hpp 2009-01-07 08:37:59.000000000 -0800 +++ boost_1_38_0/boost/math/special_functions/expm1.hpp 2009-04-20 18:24:33.312485307 -0700 @@ -267,10 +267,12 @@ #if defined(BOOST_HAS_EXPM1) && !(defined(__osf__) && defined(__DECCXX_VER)) # ifdef BOOST_MATH_USE_C99 inline float expm1(float x, const policies::policy<>&){ return ::expm1f(x); } +# ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS inline long double expm1(long double x, const policies::policy<>&){ return ::expm1l(x); } -#else +# endif +# else inline float expm1(float x, const policies::policy<>&){ return ::expm1(x); } -#endif +# endif inline double expm1(double x, const policies::policy<>&){ return ::expm1(x); } #endif
participants (2)
-
John Maddock
-
Seth LaForge