mirror of
https://github.com/boostorg/math.git
synced 2026-02-13 00:22:23 +00:00
Fixed gcc 3.2 and 3.3 build issues, tests still fail on cygwin, but pass on linux and mingw32 (seems to be a numeric_limits issue).
[SVN r21433]
This commit is contained in:
@@ -15,15 +15,14 @@
|
||||
#include <iosfwd> // for the "<<" and ">>" operators
|
||||
#include <sstream> // for the "<<" operator
|
||||
|
||||
#ifdef BOOST_NO_STD_LOCALE
|
||||
#else
|
||||
#include <boost/config.hpp> // for BOOST_NO_STD_LOCALE
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
#include <locale> // for the "<<" operator
|
||||
#endif /* BOOST_NO_STD_LOCALE */
|
||||
|
||||
#include <valarray>
|
||||
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#include <boost/math/special_functions/sinc.hpp> // for the Sinus cardinal
|
||||
#include <boost/math/special_functions/sinhc.hpp> // for the Hyperbolic Sinus cardinal
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
|
||||
#include <cmath>
|
||||
#include <limits>
|
||||
#include <boost/limits.hpp>
|
||||
#include <string>
|
||||
#include <stdexcept>
|
||||
|
||||
@@ -29,16 +29,16 @@ namespace boost
|
||||
#if defined(__GNUC__) && (__GNUC__ < 3)
|
||||
// gcc 2.x ignores function scope using declarations,
|
||||
// put them in the scope of the enclosing namespace instead:
|
||||
|
||||
|
||||
using ::std::abs;
|
||||
using ::std::sqrt;
|
||||
using ::std::sin;
|
||||
|
||||
|
||||
using ::std::numeric_limits;
|
||||
#endif /* defined(__GNUC__) && (__GNUC__ < 3) */
|
||||
|
||||
|
||||
// This is the "Sinus Cardinal" of index Pi.
|
||||
|
||||
|
||||
template<typename T>
|
||||
inline T sinc_pi(const T x)
|
||||
{
|
||||
@@ -51,13 +51,13 @@ namespace boost
|
||||
using ::std::sin;
|
||||
using ::std::sqrt;
|
||||
#endif /* BOOST_NO_STDC_NAMESPACE */
|
||||
|
||||
|
||||
using ::std::numeric_limits;
|
||||
|
||||
|
||||
static T const taylor_0_bound = numeric_limits<T>::epsilon();
|
||||
static T const taylor_2_bound = sqrt(taylor_0_bound);
|
||||
static T const taylor_n_bound = sqrt(taylor_2_bound);
|
||||
|
||||
|
||||
if (abs(x) >= taylor_n_bound)
|
||||
{
|
||||
return(sin(x)/x);
|
||||
@@ -66,32 +66,34 @@ namespace boost
|
||||
{
|
||||
// approximation by taylor series in x at 0 up to order 0
|
||||
T result = static_cast<T>(1);
|
||||
|
||||
|
||||
if (abs(x) >= taylor_0_bound)
|
||||
{
|
||||
T x2 = x*x;
|
||||
|
||||
|
||||
// approximation by taylor series in x at 0 up to order 2
|
||||
result -= x2/static_cast<T>(6);
|
||||
|
||||
|
||||
if (abs(x) >= taylor_2_bound)
|
||||
{
|
||||
// approximation by taylor series in x at 0 up to order 4
|
||||
result += (x2*x2)/static_cast<T>(120);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return(result);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef BOOST_NO_TEMPLATE_TEMPLATES
|
||||
#else /* BOOST_NO_TEMPLATE_TEMPLATES */
|
||||
template<typename T, template<typename> class U>
|
||||
inline U<T> sinc_pi(const U<T> x)
|
||||
{
|
||||
#ifdef BOOST_NO_STDC_NAMESPACE
|
||||
#if defined(BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL) || defined(__GNUC__)
|
||||
using namespace std;
|
||||
#elif defined(BOOST_NO_STDC_NAMESPACE)
|
||||
using ::abs;
|
||||
using ::sin;
|
||||
using ::sqrt;
|
||||
@@ -100,13 +102,13 @@ namespace boost
|
||||
using ::std::sin;
|
||||
using ::std::sqrt;
|
||||
#endif /* BOOST_NO_STDC_NAMESPACE */
|
||||
|
||||
|
||||
using ::std::numeric_limits;
|
||||
|
||||
|
||||
static T const taylor_0_bound = numeric_limits<T>::epsilon();
|
||||
static T const taylor_2_bound = sqrt(taylor_0_bound);
|
||||
static T const taylor_n_bound = sqrt(taylor_2_bound);
|
||||
|
||||
|
||||
if (abs(x) >= taylor_n_bound)
|
||||
{
|
||||
return(sin(x)/x);
|
||||
@@ -114,22 +116,22 @@ namespace boost
|
||||
else
|
||||
{
|
||||
// approximation by taylor series in x at 0 up to order 0
|
||||
U<T> result = static_cast< U<T> >(1);
|
||||
|
||||
U<T> result = U<T>(1);
|
||||
|
||||
if (abs(x) >= taylor_0_bound)
|
||||
{
|
||||
U<T> x2 = x*x;
|
||||
|
||||
|
||||
// approximation by taylor series in x at 0 up to order 2
|
||||
result -= x2/static_cast<T>(6);
|
||||
|
||||
|
||||
if (abs(x) >= taylor_2_bound)
|
||||
{
|
||||
// approximation by taylor series in x at 0 up to order 4
|
||||
result += (x2*x2)/static_cast<T>(120);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return(result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
|
||||
#include <cmath>
|
||||
#include <limits>
|
||||
#include <boost/limits.hpp>
|
||||
#include <string>
|
||||
#include <stdexcept>
|
||||
|
||||
@@ -29,16 +29,16 @@ namespace boost
|
||||
#if defined(__GNUC__) && (__GNUC__ < 3)
|
||||
// gcc 2.x ignores function scope using declarations,
|
||||
// put them in the scope of the enclosing namespace instead:
|
||||
|
||||
|
||||
using ::std::abs;
|
||||
using ::std::sqrt;
|
||||
using ::std::sinh;
|
||||
|
||||
|
||||
using ::std::numeric_limits;
|
||||
#endif /* defined(__GNUC__) && (__GNUC__ < 3) */
|
||||
|
||||
|
||||
// This is the "Hyperbolic Sinus Cardinal" of index Pi.
|
||||
|
||||
|
||||
template<typename T>
|
||||
inline T sinhc_pi(const T x)
|
||||
{
|
||||
@@ -51,13 +51,13 @@ namespace boost
|
||||
using ::std::sinh;
|
||||
using ::std::sqrt;
|
||||
#endif /* BOOST_NO_STDC_NAMESPACE */
|
||||
|
||||
|
||||
using ::std::numeric_limits;
|
||||
|
||||
|
||||
static T const taylor_0_bound = numeric_limits<T>::epsilon();
|
||||
static T const taylor_2_bound = sqrt(taylor_0_bound);
|
||||
static T const taylor_n_bound = sqrt(taylor_2_bound);
|
||||
|
||||
|
||||
if (abs(x) >= taylor_n_bound)
|
||||
{
|
||||
return(sinh(x)/x);
|
||||
@@ -66,32 +66,34 @@ namespace boost
|
||||
{
|
||||
// approximation by taylor series in x at 0 up to order 0
|
||||
T result = static_cast<T>(1);
|
||||
|
||||
|
||||
if (abs(x) >= taylor_0_bound)
|
||||
{
|
||||
T x2 = x*x;
|
||||
|
||||
|
||||
// approximation by taylor series in x at 0 up to order 2
|
||||
result += x2/static_cast<T>(6);
|
||||
|
||||
|
||||
if (abs(x) >= taylor_2_bound)
|
||||
{
|
||||
// approximation by taylor series in x at 0 up to order 4
|
||||
result += (x2*x2)/static_cast<T>(120);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return(result);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef BOOST_NO_TEMPLATE_TEMPLATES
|
||||
#else /* BOOST_NO_TEMPLATE_TEMPLATES */
|
||||
template<typename T, template<typename> class U>
|
||||
inline U<T> sinhc_pi(const U<T> x)
|
||||
{
|
||||
#ifdef BOOST_NO_STDC_NAMESPACE
|
||||
#if defined(BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL) || defined(__GNUC__)
|
||||
using namespace std;
|
||||
#elif defined(BOOST_NO_STDC_NAMESPACE)
|
||||
using ::abs;
|
||||
using ::sinh;
|
||||
using ::sqrt;
|
||||
@@ -100,13 +102,13 @@ namespace boost
|
||||
using ::std::sinh;
|
||||
using ::std::sqrt;
|
||||
#endif /* BOOST_NO_STDC_NAMESPACE */
|
||||
|
||||
|
||||
using ::std::numeric_limits;
|
||||
|
||||
|
||||
static T const taylor_0_bound = numeric_limits<T>::epsilon();
|
||||
static T const taylor_2_bound = sqrt(taylor_0_bound);
|
||||
static T const taylor_n_bound = sqrt(taylor_2_bound);
|
||||
|
||||
|
||||
if (abs(x) >= taylor_n_bound)
|
||||
{
|
||||
return(sinh(x)/x);
|
||||
@@ -114,22 +116,22 @@ namespace boost
|
||||
else
|
||||
{
|
||||
// approximation by taylor series in x at 0 up to order 0
|
||||
U<T> result = static_cast< U<T> >(1);
|
||||
|
||||
U<T> result = U<T>(1);
|
||||
|
||||
if (abs(x) >= taylor_0_bound)
|
||||
{
|
||||
U<T> x2 = x*x;
|
||||
|
||||
|
||||
// approximation by taylor series in x at 0 up to order 2
|
||||
result += x2/static_cast<T>(6);
|
||||
|
||||
|
||||
if (abs(x) >= taylor_2_bound)
|
||||
{
|
||||
// approximation by taylor series in x at 0 up to order 4
|
||||
result += (x2*x2)/static_cast<T>(120);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return(result);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user