update boost
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -9,8 +9,8 @@
|
||||
|
||||
// Implement quadruple-precision (and extended) support for <complex>.
|
||||
|
||||
#ifndef _BOOST_CSTDFLOAT_COMPLEX_2014_02_15_HPP_
|
||||
#define _BOOST_CSTDFLOAT_COMPLEX_2014_02_15_HPP_
|
||||
#ifndef BOOST_MATH_CSTDFLOAT_COMPLEX_2014_02_15_HPP_
|
||||
#define BOOST_MATH_CSTDFLOAT_COMPLEX_2014_02_15_HPP_
|
||||
|
||||
#include <boost/math/cstdfloat/cstdfloat_types.hpp>
|
||||
#include <boost/math/cstdfloat/cstdfloat_limits.hpp>
|
||||
@@ -35,4 +35,4 @@
|
||||
|
||||
#endif // Not BOOST_CSTDFLOAT_NO_LIBQUADMATH_SUPPORT (i.e., the user would like to have libquadmath support)
|
||||
|
||||
#endif // _BOOST_CSTDFLOAT_COMPLEX_2014_02_15_HPP_
|
||||
#endif // BOOST_MATH_CSTDFLOAT_COMPLEX_2014_02_15_HPP_
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
// Implement a specialization of std::complex<> for *anything* that
|
||||
// is defined as BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE.
|
||||
|
||||
#ifndef _BOOST_CSTDFLOAT_COMPLEX_STD_2014_02_15_HPP_
|
||||
#define _BOOST_CSTDFLOAT_COMPLEX_STD_2014_02_15_HPP_
|
||||
#ifndef BOOST_MATH_CSTDFLOAT_COMPLEX_STD_2014_02_15_HPP_
|
||||
#define BOOST_MATH_CSTDFLOAT_COMPLEX_STD_2014_02_15_HPP_
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#pragma GCC system_header
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
#include <complex>
|
||||
#include <boost/math/constants/constants.hpp>
|
||||
#include <boost/math/tools/cxx03_warn.hpp>
|
||||
|
||||
namespace std
|
||||
{
|
||||
@@ -85,9 +86,9 @@
|
||||
public:
|
||||
typedef BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE value_type;
|
||||
|
||||
explicit complex(const complex<float>&);
|
||||
explicit complex(const complex<double>&);
|
||||
explicit complex(const complex<long double>&);
|
||||
complex(const complex<float>&);
|
||||
complex(const complex<double>&);
|
||||
complex(const complex<long double>&);
|
||||
|
||||
#if defined(BOOST_NO_CXX11_CONSTEXPR)
|
||||
complex(const value_type& r = value_type(),
|
||||
@@ -95,8 +96,8 @@
|
||||
im(i) { }
|
||||
|
||||
template<typename X>
|
||||
complex(const complex<X>& x) : re(x.real()),
|
||||
im(x.imag()) { }
|
||||
explicit complex(const complex<X>& x) : re(x.real()),
|
||||
im(x.imag()) { }
|
||||
|
||||
const value_type& real() const { return re; }
|
||||
const value_type& imag() const { return im; }
|
||||
@@ -104,13 +105,13 @@
|
||||
value_type& real() { return re; }
|
||||
value_type& imag() { return im; }
|
||||
#else
|
||||
BOOST_CONSTEXPR complex(const value_type& r = value_type(),
|
||||
const value_type& i = value_type()) : re(r),
|
||||
im(i) { }
|
||||
constexpr complex(const value_type& r = value_type(),
|
||||
const value_type& i = value_type()) : re(r),
|
||||
im(i) { }
|
||||
|
||||
template<typename X>
|
||||
BOOST_CONSTEXPR complex(const complex<X>& x) : re(x.real()),
|
||||
im(x.imag()) { }
|
||||
explicit constexpr complex(const complex<X>& x) : re(x.real()),
|
||||
im(x.imag()) { }
|
||||
|
||||
value_type real() const { return re; }
|
||||
value_type imag() const { return im; }
|
||||
@@ -229,10 +230,10 @@
|
||||
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> proj (const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& x)
|
||||
{
|
||||
const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE m = (std::numeric_limits<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>::max)();
|
||||
if ((x.real() > m)
|
||||
|| (x.real() < -m)
|
||||
|| (x.imag() > m)
|
||||
|| (x.imag() < -m))
|
||||
if ( (x.real() > m)
|
||||
|| (x.real() < -m)
|
||||
|| (x.imag() > m)
|
||||
|| (x.imag() < -m))
|
||||
{
|
||||
// We have an infinity, return a normalized infinity, respecting the sign of the imaginary part:
|
||||
return complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>(std::numeric_limits<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>::infinity(), x.imag() < 0 ? -0 : 0);
|
||||
@@ -402,7 +403,62 @@
|
||||
using std::atan2;
|
||||
using std::log;
|
||||
|
||||
return complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>(log(std::norm(x)) / 2, atan2(x.imag(), x.real()));
|
||||
const bool re_isneg = (x.real() < 0);
|
||||
const bool re_isnan = (x.real() != x.real());
|
||||
const bool re_isinf = ((!re_isneg) ? bool(+x.real() > (std::numeric_limits<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>::max)())
|
||||
: bool(-x.real() > (std::numeric_limits<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>::max)()));
|
||||
|
||||
const bool im_isneg = (x.imag() < 0);
|
||||
const bool im_isnan = (x.imag() != x.imag());
|
||||
const bool im_isinf = ((!im_isneg) ? bool(+x.imag() > (std::numeric_limits<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>::max)())
|
||||
: bool(-x.imag() > (std::numeric_limits<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>::max)()));
|
||||
|
||||
if(re_isnan || im_isnan) { return x; }
|
||||
|
||||
if(re_isinf || im_isinf)
|
||||
{
|
||||
return complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>(std::numeric_limits<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>::infinity(),
|
||||
BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE(0.0));
|
||||
}
|
||||
|
||||
const bool re_iszero = ((re_isneg || (x.real() > 0)) == false);
|
||||
|
||||
if(re_iszero)
|
||||
{
|
||||
const bool im_iszero = ((im_isneg || (x.imag() > 0)) == false);
|
||||
|
||||
if(im_iszero)
|
||||
{
|
||||
return std::complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>
|
||||
(
|
||||
-std::numeric_limits<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>::infinity(),
|
||||
BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE(0.0)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(im_isneg == false)
|
||||
{
|
||||
return std::complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>
|
||||
(
|
||||
log(x.imag()),
|
||||
boost::math::constants::half_pi<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>()
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
return std::complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>
|
||||
(
|
||||
log(-x.imag()),
|
||||
-boost::math::constants::half_pi<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>(log(std::norm(x)) / 2, atan2(x.imag(), x.real()));
|
||||
}
|
||||
}
|
||||
|
||||
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> log10(const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& x)
|
||||
@@ -496,19 +552,135 @@
|
||||
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> pow(const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& x,
|
||||
const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE& a)
|
||||
{
|
||||
return std::exp(a * std::log(x));
|
||||
const bool x_im_isneg = (x.imag() < 0);
|
||||
const bool x_im_iszero = ((x_im_isneg || (x.imag() > 0)) == false);
|
||||
|
||||
if(x_im_iszero)
|
||||
{
|
||||
using std::pow;
|
||||
|
||||
const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE pxa = pow(x.real(), a);
|
||||
|
||||
return complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>(pxa, BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE(0));
|
||||
}
|
||||
else
|
||||
{
|
||||
return std::exp(a * std::log(x));
|
||||
}
|
||||
}
|
||||
|
||||
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> pow(const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& x,
|
||||
const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& a)
|
||||
{
|
||||
return std::exp(a * std::log(x));
|
||||
const bool x_im_isneg = (x.imag() < 0);
|
||||
const bool x_im_iszero = ((x_im_isneg || (x.imag() > 0)) == false);
|
||||
|
||||
if(x_im_iszero)
|
||||
{
|
||||
using std::pow;
|
||||
|
||||
return pow(x.real(), a);
|
||||
}
|
||||
else
|
||||
{
|
||||
return std::exp(a * std::log(x));
|
||||
}
|
||||
}
|
||||
|
||||
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> pow(const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE& x,
|
||||
const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& a)
|
||||
{
|
||||
return std::exp(a * std::log(x));
|
||||
const bool x_isneg = (x < 0);
|
||||
const bool x_isnan = (x != x);
|
||||
const bool x_isinf = ((!x_isneg) ? bool(+x > (std::numeric_limits<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>::max)())
|
||||
: bool(-x > (std::numeric_limits<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>::max)()));
|
||||
|
||||
const bool a_re_isneg = (a.real() < 0);
|
||||
const bool a_re_isnan = (a.real() != a.real());
|
||||
const bool a_re_isinf = ((!a_re_isneg) ? bool(+a.real() > (std::numeric_limits<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>::max)())
|
||||
: bool(-a.real() > (std::numeric_limits<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>::max)()));
|
||||
|
||||
const bool a_im_isneg = (a.imag() < 0);
|
||||
const bool a_im_isnan = (a.imag() != a.imag());
|
||||
const bool a_im_isinf = ((!a_im_isneg) ? bool(+a.imag() > (std::numeric_limits<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>::max)())
|
||||
: bool(-a.imag() > (std::numeric_limits<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>::max)()));
|
||||
|
||||
const bool args_is_nan = (x_isnan || a_re_isnan || a_im_isnan);
|
||||
const bool a_is_finite = (!(a_re_isnan || a_re_isinf || a_im_isnan || a_im_isinf));
|
||||
|
||||
complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> result;
|
||||
|
||||
if(args_is_nan)
|
||||
{
|
||||
result =
|
||||
complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>
|
||||
(
|
||||
std::numeric_limits<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>::quiet_NaN(),
|
||||
std::numeric_limits<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>::quiet_NaN()
|
||||
);
|
||||
}
|
||||
else if(x_isinf)
|
||||
{
|
||||
if(a_is_finite)
|
||||
{
|
||||
result =
|
||||
complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>
|
||||
(
|
||||
std::numeric_limits<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>::infinity(),
|
||||
std::numeric_limits<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>::infinity()
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
result =
|
||||
complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>
|
||||
(
|
||||
std::numeric_limits<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>::quiet_NaN(),
|
||||
std::numeric_limits<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>::quiet_NaN()
|
||||
);
|
||||
}
|
||||
}
|
||||
else if(x > 0)
|
||||
{
|
||||
result = std::exp(a * std::log(x));
|
||||
}
|
||||
else if(x < 0)
|
||||
{
|
||||
using std::acos;
|
||||
using std::log;
|
||||
|
||||
const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>
|
||||
cpx_lg_x
|
||||
(
|
||||
log(-x),
|
||||
acos(BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE(-1))
|
||||
);
|
||||
|
||||
result = std::exp(a * cpx_lg_x);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(a_is_finite)
|
||||
{
|
||||
result =
|
||||
complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>
|
||||
(
|
||||
BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE(0),
|
||||
BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE(0)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
result =
|
||||
complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>
|
||||
(
|
||||
std::numeric_limits<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>::quiet_NaN(),
|
||||
std::numeric_limits<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>::quiet_NaN()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> sinh(const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& x)
|
||||
@@ -638,4 +810,4 @@
|
||||
}
|
||||
} // namespace std
|
||||
|
||||
#endif // _BOOST_CSTDFLOAT_COMPLEX_STD_2014_02_15_HPP_
|
||||
#endif // BOOST_MATH_CSTDFLOAT_COMPLEX_STD_2014_02_15_HPP_
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
// Implement quadruple-precision I/O stream operations.
|
||||
|
||||
#ifndef _BOOST_CSTDFLOAT_IOSTREAM_2014_02_15_HPP_
|
||||
#define _BOOST_CSTDFLOAT_IOSTREAM_2014_02_15_HPP_
|
||||
#ifndef BOOST_MATH_CSTDFLOAT_IOSTREAM_2014_02_15_HPP_
|
||||
#define BOOST_MATH_CSTDFLOAT_IOSTREAM_2014_02_15_HPP_
|
||||
|
||||
#include <boost/math/cstdfloat/cstdfloat_types.hpp>
|
||||
#include <boost/math/cstdfloat/cstdfloat_limits.hpp>
|
||||
@@ -28,15 +28,16 @@
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <boost/math/tools/assert.hpp>
|
||||
#include <boost/math/tools/nothrow.hpp>
|
||||
#include <boost/math/tools/throw_exception.hpp>
|
||||
|
||||
// #if (0)
|
||||
#if defined(__GNUC__)
|
||||
|
||||
// Forward declarations of quadruple-precision string functions.
|
||||
extern "C" int quadmath_snprintf(char *str, size_t size, const char *format, ...) throw();
|
||||
extern "C" boost::math::cstdfloat::detail::float_internal128_t strtoflt128(const char*, char **) throw();
|
||||
extern "C" int quadmath_snprintf(char *str, size_t size, const char *format, ...) BOOST_MATH_NOTHROW;
|
||||
extern "C" boost::math::cstdfloat::detail::float_internal128_t strtoflt128(const char*, char **) BOOST_MATH_NOTHROW;
|
||||
|
||||
namespace std
|
||||
{
|
||||
@@ -86,7 +87,7 @@
|
||||
my_digits,
|
||||
x);
|
||||
|
||||
if(v < 0) { BOOST_THROW_EXCEPTION(std::runtime_error("Formatting of boost::float128_t failed internally in quadmath_snprintf().")); }
|
||||
if(v < 0) { BOOST_MATH_THROW_EXCEPTION(std::runtime_error("Formatting of boost::float128_t failed internally in quadmath_snprintf().")); }
|
||||
|
||||
if(v >= static_cast<int>(sizeof(my_buffer) - 1U))
|
||||
{
|
||||
@@ -106,7 +107,7 @@
|
||||
}
|
||||
catch(const std::bad_alloc&)
|
||||
{
|
||||
BOOST_THROW_EXCEPTION(std::runtime_error("Formatting of boost::float128_t failed while allocating memory."));
|
||||
BOOST_MATH_THROW_EXCEPTION(std::runtime_error("Formatting of boost::float128_t failed while allocating memory."));
|
||||
}
|
||||
#endif
|
||||
const int v2 = ::quadmath_snprintf(my_buffer2,
|
||||
@@ -117,7 +118,7 @@
|
||||
|
||||
if(v2 >= v + 3)
|
||||
{
|
||||
BOOST_THROW_EXCEPTION(std::runtime_error("Formatting of boost::float128_t failed."));
|
||||
BOOST_MATH_THROW_EXCEPTION(std::runtime_error("Formatting of boost::float128_t failed."));
|
||||
}
|
||||
|
||||
static_cast<void>(ostr << my_buffer2);
|
||||
@@ -152,7 +153,7 @@
|
||||
|
||||
is.setstate(ios_base::failbit);
|
||||
|
||||
BOOST_THROW_EXCEPTION(std::runtime_error("Unable to interpret input string as a boost::float128_t"));
|
||||
BOOST_MATH_THROW_EXCEPTION(std::runtime_error("Unable to interpret input string as a boost::float128_t"));
|
||||
}
|
||||
|
||||
return is;
|
||||
@@ -160,7 +161,7 @@
|
||||
}
|
||||
|
||||
// #elif defined(__GNUC__)
|
||||
#elif defined(BOOST_INTEL)
|
||||
#elif defined(__INTEL_COMPILER)
|
||||
|
||||
// The section for I/O stream support for the ICC compiler is particularly
|
||||
// long, because these functions must be painstakingly synthesized from
|
||||
@@ -173,8 +174,7 @@
|
||||
|
||||
#include <cstring>
|
||||
#include <cctype>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
|
||||
namespace boost { namespace math { namespace cstdfloat { namespace detail {
|
||||
|
||||
template<class string_type>
|
||||
@@ -331,7 +331,8 @@
|
||||
}
|
||||
|
||||
str.append(1U, 'e');
|
||||
string_type e = boost::lexical_cast<string_type>(std::abs(my_exp));
|
||||
|
||||
string_type e = std::to_string(std::abs(my_exp));
|
||||
|
||||
if(e.size() < 2U)
|
||||
{
|
||||
@@ -576,12 +577,12 @@
|
||||
bool is_neg = false;
|
||||
bool is_neg_expon = false;
|
||||
|
||||
BOOST_CONSTEXPR_OR_CONST int ten = 10;
|
||||
constexpr int ten = 10;
|
||||
|
||||
int expon = 0;
|
||||
int digits_seen = 0;
|
||||
|
||||
BOOST_CONSTEXPR_OR_CONST int max_digits = std::numeric_limits<float_type>::max_digits10 + 1;
|
||||
constexpr int max_digits = std::numeric_limits<float_type>::max_digits10 + 1;
|
||||
|
||||
if(*p == static_cast<char>('+'))
|
||||
{
|
||||
@@ -760,15 +761,15 @@
|
||||
|
||||
is.setstate(ios_base::failbit);
|
||||
|
||||
BOOST_THROW_EXCEPTION(std::runtime_error("Unable to interpret input string as a boost::float128_t"));
|
||||
BOOST_MATH_THROW_EXCEPTION(std::runtime_error("Unable to interpret input string as a boost::float128_t"));
|
||||
}
|
||||
|
||||
return is;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // Use __GNUC__ or BOOST_INTEL libquadmath
|
||||
#endif // Use __GNUC__ or __INTEL_COMPILER libquadmath
|
||||
|
||||
#endif // Not BOOST_CSTDFLOAT_NO_LIBQUADMATH_SUPPORT (i.e., the user would like to have libquadmath support)
|
||||
|
||||
#endif // _BOOST_CSTDFLOAT_IOSTREAM_2014_02_15_HPP_
|
||||
#endif // BOOST_MATH_CSTDFLOAT_IOSTREAM_2014_02_15_HPP_
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
// Implement quadruple-precision std::numeric_limits<> support.
|
||||
|
||||
#ifndef _BOOST_CSTDFLOAT_LIMITS_2014_01_09_HPP_
|
||||
#define _BOOST_CSTDFLOAT_LIMITS_2014_01_09_HPP_
|
||||
#ifndef BOOST_MATH_CSTDFLOAT_LIMITS_2014_01_09_HPP_
|
||||
#define BOOST_MATH_CSTDFLOAT_LIMITS_2014_01_09_HPP_
|
||||
|
||||
#include <boost/math/cstdfloat/cstdfloat_types.hpp>
|
||||
|
||||
@@ -19,25 +19,26 @@
|
||||
// This is the only way we can avoid
|
||||
// warning: non-standard suffix on floating constant [-Wpedantic]
|
||||
// when building with -Wall -pedantic. Neither __extension__
|
||||
// nor #pragma dianostic ignored work :(
|
||||
// nor #pragma diagnostic ignored work :(
|
||||
//
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_CSTDFLOAT_HAS_INTERNAL_FLOAT128_T) && defined(BOOST_MATH_USE_FLOAT128) && !defined(BOOST_CSTDFLOAT_NO_LIBQUADMATH_SUPPORT)
|
||||
#if defined(BOOST_CSTDFLOAT_HAS_INTERNAL_FLOAT128_T) && defined(BOOST_MATH_USE_FLOAT128) && !defined(BOOST_CSTDFLOAT_NO_LIBQUADMATH_SUPPORT) && (!defined(__GNUC__) || (defined(__GNUC__) && __GNUC__ < 14))
|
||||
|
||||
#include <limits>
|
||||
#include <boost/math/tools/nothrow.hpp>
|
||||
|
||||
// Define the name of the global quadruple-precision function to be used for
|
||||
// calculating quiet_NaN() in the specialization of std::numeric_limits<>.
|
||||
#if defined(BOOST_INTEL)
|
||||
#if defined(__INTEL_COMPILER)
|
||||
#define BOOST_CSTDFLOAT_FLOAT128_SQRT __sqrtq
|
||||
#elif defined(__GNUC__)
|
||||
#define BOOST_CSTDFLOAT_FLOAT128_SQRT sqrtq
|
||||
#endif
|
||||
|
||||
// Forward declaration of the quadruple-precision square root function.
|
||||
extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_SQRT(boost::math::cstdfloat::detail::float_internal128_t) throw();
|
||||
extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_SQRT(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
|
||||
|
||||
namespace std
|
||||
{
|
||||
@@ -45,42 +46,42 @@
|
||||
class numeric_limits<boost::math::cstdfloat::detail::float_internal128_t>
|
||||
{
|
||||
public:
|
||||
BOOST_STATIC_CONSTEXPR bool is_specialized = true;
|
||||
static boost::math::cstdfloat::detail::float_internal128_t (min) () BOOST_NOEXCEPT { return BOOST_CSTDFLOAT_FLOAT128_MIN; }
|
||||
static boost::math::cstdfloat::detail::float_internal128_t (max) () BOOST_NOEXCEPT { return BOOST_CSTDFLOAT_FLOAT128_MAX; }
|
||||
static boost::math::cstdfloat::detail::float_internal128_t lowest() BOOST_NOEXCEPT { return -(max)(); }
|
||||
BOOST_STATIC_CONSTEXPR int digits = 113;
|
||||
BOOST_STATIC_CONSTEXPR int digits10 = 33;
|
||||
BOOST_STATIC_CONSTEXPR int max_digits10 = 36;
|
||||
BOOST_STATIC_CONSTEXPR bool is_signed = true;
|
||||
BOOST_STATIC_CONSTEXPR bool is_integer = false;
|
||||
BOOST_STATIC_CONSTEXPR bool is_exact = false;
|
||||
BOOST_STATIC_CONSTEXPR int radix = 2;
|
||||
static constexpr bool is_specialized = true;
|
||||
static boost::math::cstdfloat::detail::float_internal128_t (min) () noexcept { return BOOST_CSTDFLOAT_FLOAT128_MIN; }
|
||||
static boost::math::cstdfloat::detail::float_internal128_t (max) () noexcept { return BOOST_CSTDFLOAT_FLOAT128_MAX; }
|
||||
static boost::math::cstdfloat::detail::float_internal128_t lowest() noexcept { return -(max)(); }
|
||||
static constexpr int digits = 113;
|
||||
static constexpr int digits10 = 33;
|
||||
static constexpr int max_digits10 = 36;
|
||||
static constexpr bool is_signed = true;
|
||||
static constexpr bool is_integer = false;
|
||||
static constexpr bool is_exact = false;
|
||||
static constexpr int radix = 2;
|
||||
static boost::math::cstdfloat::detail::float_internal128_t epsilon () { return BOOST_CSTDFLOAT_FLOAT128_EPS; }
|
||||
static boost::math::cstdfloat::detail::float_internal128_t round_error() { return BOOST_FLOAT128_C(0.5); }
|
||||
BOOST_STATIC_CONSTEXPR int min_exponent = -16381;
|
||||
BOOST_STATIC_CONSTEXPR int min_exponent10 = static_cast<int>((min_exponent * 301L) / 1000L);
|
||||
BOOST_STATIC_CONSTEXPR int max_exponent = +16384;
|
||||
BOOST_STATIC_CONSTEXPR int max_exponent10 = static_cast<int>((max_exponent * 301L) / 1000L);
|
||||
BOOST_STATIC_CONSTEXPR bool has_infinity = true;
|
||||
BOOST_STATIC_CONSTEXPR bool has_quiet_NaN = true;
|
||||
BOOST_STATIC_CONSTEXPR bool has_signaling_NaN = false;
|
||||
BOOST_STATIC_CONSTEXPR float_denorm_style has_denorm = denorm_present;
|
||||
BOOST_STATIC_CONSTEXPR bool has_denorm_loss = false;
|
||||
static constexpr int min_exponent = -16381;
|
||||
static constexpr int min_exponent10 = static_cast<int>((min_exponent * 301L) / 1000L);
|
||||
static constexpr int max_exponent = +16384;
|
||||
static constexpr int max_exponent10 = static_cast<int>((max_exponent * 301L) / 1000L);
|
||||
static constexpr bool has_infinity = true;
|
||||
static constexpr bool has_quiet_NaN = true;
|
||||
static constexpr bool has_signaling_NaN = false;
|
||||
static constexpr float_denorm_style has_denorm = denorm_present;
|
||||
static constexpr bool has_denorm_loss = false;
|
||||
static boost::math::cstdfloat::detail::float_internal128_t infinity () { return BOOST_FLOAT128_C(1.0) / BOOST_FLOAT128_C(0.0); }
|
||||
static boost::math::cstdfloat::detail::float_internal128_t quiet_NaN () { return -(::BOOST_CSTDFLOAT_FLOAT128_SQRT(BOOST_FLOAT128_C(-1.0))); }
|
||||
static boost::math::cstdfloat::detail::float_internal128_t signaling_NaN() { return BOOST_FLOAT128_C(0.0); }
|
||||
static boost::math::cstdfloat::detail::float_internal128_t denorm_min () { return BOOST_CSTDFLOAT_FLOAT128_DENORM_MIN; }
|
||||
BOOST_STATIC_CONSTEXPR bool is_iec559 = true;
|
||||
BOOST_STATIC_CONSTEXPR bool is_bounded = true;
|
||||
BOOST_STATIC_CONSTEXPR bool is_modulo = false;
|
||||
BOOST_STATIC_CONSTEXPR bool traps = false;
|
||||
BOOST_STATIC_CONSTEXPR bool tinyness_before = false;
|
||||
BOOST_STATIC_CONSTEXPR float_round_style round_style = round_to_nearest;
|
||||
static constexpr bool is_iec559 = true;
|
||||
static constexpr bool is_bounded = true;
|
||||
static constexpr bool is_modulo = false;
|
||||
static constexpr bool traps = false;
|
||||
static constexpr bool tinyness_before = false;
|
||||
static constexpr float_round_style round_style = round_to_nearest;
|
||||
};
|
||||
} // namespace std
|
||||
|
||||
#endif // Not BOOST_CSTDFLOAT_NO_LIBQUADMATH_SUPPORT (i.e., the user would like to have libquadmath support)
|
||||
|
||||
#endif // _BOOST_CSTDFLOAT_LIMITS_2014_01_09_HPP_
|
||||
#endif // BOOST_MATH_CSTDFLOAT_LIMITS_2014_01_09_HPP_
|
||||
|
||||
|
||||
@@ -9,18 +9,17 @@
|
||||
|
||||
// Implement the types for floating-point typedefs having specified widths.
|
||||
|
||||
#ifndef _BOOST_CSTDFLOAT_TYPES_2014_01_09_HPP_
|
||||
#define _BOOST_CSTDFLOAT_TYPES_2014_01_09_HPP_
|
||||
#ifndef BOOST_MATH_CSTDFLOAT_TYPES_2014_01_09_HPP_
|
||||
#define BOOST_MATH_CSTDFLOAT_TYPES_2014_01_09_HPP_
|
||||
|
||||
#include <float.h>
|
||||
#include <cfloat>
|
||||
#include <limits>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/math/tools/config.hpp>
|
||||
|
||||
// This is the beginning of the preamble.
|
||||
|
||||
// In this preamble, the preprocessor is used to query certain
|
||||
// preprocessor definitions from <float.h>. Based on the results
|
||||
// preprocessor definitions from <cfloat>. Based on the results
|
||||
// of these queries, an attempt is made to automatically detect
|
||||
// the presence of built-in floating-point types having specified
|
||||
// widths. These are *thought* to be conformant with IEEE-754,
|
||||
@@ -213,7 +212,7 @@
|
||||
namespace boost { namespace math { namespace cstdfloat { namespace detail {
|
||||
#if defined(__GNUC__)
|
||||
typedef __float128 float_internal128_t;
|
||||
#elif defined(BOOST_INTEL)
|
||||
#elif defined(__INTEL_COMPILER)
|
||||
typedef _Quad float_internal128_t;
|
||||
#else
|
||||
#error "Sorry, the compiler is neither GCC, nor Intel, I don't know how to configure <boost/cstdfloat.hpp>."
|
||||
@@ -229,7 +228,7 @@
|
||||
#define BOOST_CSTDFLOAT_FLOAT128_MIN 3.36210314311209350626267781732175260e-4932Q
|
||||
#define BOOST_CSTDFLOAT_FLOAT128_MAX 1.18973149535723176508575932662800702e+4932Q
|
||||
#define BOOST_CSTDFLOAT_FLOAT128_EPS 1.92592994438723585305597794258492732e-0034Q
|
||||
#define BOOST_CSTDFLOAT_FLOAT128_DENORM_MIN 6.475175119438025110924438958227646552e-4966Q
|
||||
#define BOOST_CSTDFLOAT_FLOAT128_DENORM_MIN 6.475175119438025110924438958227646552e-4966Q
|
||||
|
||||
#endif // Not BOOST_CSTDFLOAT_NO_LIBQUADMATH_SUPPORT (i.e., the user would like to have libquadmath support)
|
||||
|
||||
@@ -324,7 +323,7 @@
|
||||
// as the corresponding fixed-width type. This behavior may, however,
|
||||
// be modified when being optimized for a given compiler implementation.
|
||||
|
||||
// In addition, a clear assessment of IEEE-754 comformance is carried out
|
||||
// In addition, a clear assessment of IEEE-754 conformance is carried out
|
||||
// using compile-time assertion.
|
||||
|
||||
namespace boost
|
||||
@@ -334,10 +333,10 @@
|
||||
typedef boost::float16_t float_fast16_t;
|
||||
typedef boost::float16_t float_least16_t;
|
||||
|
||||
BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float16_t>::is_iec559 == true, "boost::float16_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float16_t>::radix == 2, "boost::float16_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float16_t>::digits == 11, "boost::float16_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float16_t>::max_exponent == 16, "boost::float16_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
static_assert(std::numeric_limits<boost::float16_t>::is_iec559 == true, "boost::float16_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
static_assert(std::numeric_limits<boost::float16_t>::radix == 2, "boost::float16_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
static_assert(std::numeric_limits<boost::float16_t>::digits == 11, "boost::float16_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
static_assert(std::numeric_limits<boost::float16_t>::max_exponent == 16, "boost::float16_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
|
||||
#undef BOOST_CSTDFLOAT_FLOAT_16_MIN
|
||||
#undef BOOST_CSTDFLOAT_FLOAT_16_MAX
|
||||
@@ -348,10 +347,10 @@
|
||||
typedef boost::float32_t float_fast32_t;
|
||||
typedef boost::float32_t float_least32_t;
|
||||
|
||||
BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float32_t>::is_iec559 == true, "boost::float32_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float32_t>::radix == 2, "boost::float32_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float32_t>::digits == 24, "boost::float32_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float32_t>::max_exponent == 128, "boost::float32_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
static_assert(std::numeric_limits<boost::float32_t>::is_iec559 == true, "boost::float32_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
static_assert(std::numeric_limits<boost::float32_t>::radix == 2, "boost::float32_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
static_assert(std::numeric_limits<boost::float32_t>::digits == 24, "boost::float32_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
static_assert(std::numeric_limits<boost::float32_t>::max_exponent == 128, "boost::float32_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
|
||||
#undef BOOST_CSTDFLOAT_FLOAT_32_MIN
|
||||
#undef BOOST_CSTDFLOAT_FLOAT_32_MAX
|
||||
@@ -371,10 +370,10 @@
|
||||
typedef boost::float64_t float_fast64_t;
|
||||
typedef boost::float64_t float_least64_t;
|
||||
|
||||
BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float64_t>::is_iec559 == true, "boost::float64_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float64_t>::radix == 2, "boost::float64_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float64_t>::digits == 53, "boost::float64_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float64_t>::max_exponent == 1024, "boost::float64_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
static_assert(std::numeric_limits<boost::float64_t>::is_iec559 == true, "boost::float64_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
static_assert(std::numeric_limits<boost::float64_t>::radix == 2, "boost::float64_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
static_assert(std::numeric_limits<boost::float64_t>::digits == 53, "boost::float64_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
static_assert(std::numeric_limits<boost::float64_t>::max_exponent == 1024, "boost::float64_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
|
||||
#undef BOOST_CSTDFLOAT_FLOAT_64_MIN
|
||||
#undef BOOST_CSTDFLOAT_FLOAT_64_MAX
|
||||
@@ -385,10 +384,10 @@
|
||||
typedef boost::float80_t float_fast80_t;
|
||||
typedef boost::float80_t float_least80_t;
|
||||
|
||||
BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float80_t>::is_iec559 == true, "boost::float80_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float80_t>::radix == 2, "boost::float80_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float80_t>::digits == 64, "boost::float80_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float80_t>::max_exponent == 16384, "boost::float80_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
static_assert(std::numeric_limits<boost::float80_t>::is_iec559 == true, "boost::float80_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
static_assert(std::numeric_limits<boost::float80_t>::radix == 2, "boost::float80_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
static_assert(std::numeric_limits<boost::float80_t>::digits == 64, "boost::float80_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
static_assert(std::numeric_limits<boost::float80_t>::max_exponent == 16384, "boost::float80_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
|
||||
#undef BOOST_CSTDFLOAT_FLOAT_80_MIN
|
||||
#undef BOOST_CSTDFLOAT_FLOAT_80_MAX
|
||||
@@ -404,10 +403,10 @@
|
||||
// Support for std::numeric_limits<boost::float128_t> is added in the detail
|
||||
// file <boost/math/cstdfloat/cstdfloat_limits.hpp>.
|
||||
#else
|
||||
BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float128_t>::is_iec559 == true, "boost::float128_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float128_t>::radix == 2, "boost::float128_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float128_t>::digits == 113, "boost::float128_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float128_t>::max_exponent == 16384, "boost::float128_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
static_assert(std::numeric_limits<boost::float128_t>::is_iec559 == true, "boost::float128_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
static_assert(std::numeric_limits<boost::float128_t>::radix == 2, "boost::float128_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
static_assert(std::numeric_limits<boost::float128_t>::digits == 113, "boost::float128_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
static_assert(std::numeric_limits<boost::float128_t>::max_exponent == 16384, "boost::float128_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
#endif
|
||||
|
||||
#undef BOOST_CSTDFLOAT_FLOAT_128_MIN
|
||||
@@ -438,5 +437,5 @@
|
||||
}
|
||||
// namespace boost
|
||||
|
||||
#endif // _BOOST_CSTDFLOAT_BASE_TYPES_2014_01_09_HPP_
|
||||
#endif // BOOST_MATH_CSTDFLOAT_BASE_TYPES_2014_01_09_HPP_
|
||||
|
||||
|
||||
Reference in New Issue
Block a user