Revert name changes and add ldbl tests

This commit is contained in:
Christopher Kormanyos
2021-08-18 07:17:56 +02:00
parent 2a5c6d3327
commit 7d61ecb1d8
31 changed files with 533 additions and 528 deletions
@@ -6,7 +6,7 @@
// (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// Timed multiplication cpp_quad_fp_backend<double> versus cpp_bin_float
// Timed multiplication cpp_quad_float<double> versus cpp_bin_float
#include <ctime>
#include <iomanip>
@@ -51,7 +51,7 @@ namespace local
static unsigned seed_prescaler;
using quad_float_type = boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_fp_backend<float_type>, boost::multiprecision::et_off>;
using quad_float_type = boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_float<float_type>, boost::multiprecision::et_off>;
using control_float_type = boost::multiprecision::number<boost::multiprecision::cpp_bin_float<digits10>, boost::multiprecision::et_off>;
static_assert( digits == std::numeric_limits<quad_float_type>::digits , "Discrepancy in limts." );
+179 -179
View File
@@ -32,7 +32,7 @@
namespace boost { namespace multiprecision { namespace backends {
template <typename FloatingPointType>
class cpp_double_fp_backend;
class cpp_double_float;
namespace detail {
@@ -59,101 +59,101 @@ struct is_floating_point_or_float128
} // namespace detail
template <typename FloatingPointType>
inline cpp_double_fp_backend<FloatingPointType> operator+(const cpp_double_fp_backend<FloatingPointType>& a, const cpp_double_fp_backend<FloatingPointType>& b);
inline cpp_double_float<FloatingPointType> operator+(const cpp_double_float<FloatingPointType>& a, const cpp_double_float<FloatingPointType>& b);
template <typename FloatingPointType>
inline cpp_double_fp_backend<FloatingPointType> operator-(const cpp_double_fp_backend<FloatingPointType>& a, const cpp_double_fp_backend<FloatingPointType>& b);
inline cpp_double_float<FloatingPointType> operator-(const cpp_double_float<FloatingPointType>& a, const cpp_double_float<FloatingPointType>& b);
template <typename FloatingPointType>
inline cpp_double_fp_backend<FloatingPointType> operator*(const cpp_double_fp_backend<FloatingPointType>& a, const cpp_double_fp_backend<FloatingPointType>& b);
inline cpp_double_float<FloatingPointType> operator*(const cpp_double_float<FloatingPointType>& a, const cpp_double_float<FloatingPointType>& b);
template <typename FloatingPointType>
inline cpp_double_fp_backend<FloatingPointType> operator/(const cpp_double_fp_backend<FloatingPointType>& a, const cpp_double_fp_backend<FloatingPointType>& b);
inline cpp_double_float<FloatingPointType> operator/(const cpp_double_float<FloatingPointType>& a, const cpp_double_float<FloatingPointType>& b);
template <typename FloatingPointType>
cpp_double_fp_backend<FloatingPointType> operator+(const cpp_double_fp_backend<FloatingPointType>& a, const FloatingPointType& b);
cpp_double_float<FloatingPointType> operator+(const cpp_double_float<FloatingPointType>& a, const FloatingPointType& b);
template <typename FloatingPointType>
cpp_double_fp_backend<FloatingPointType> operator-(const cpp_double_fp_backend<FloatingPointType>& a, const FloatingPointType& b);
cpp_double_float<FloatingPointType> operator-(const cpp_double_float<FloatingPointType>& a, const FloatingPointType& b);
template <typename FloatingPointType>
cpp_double_fp_backend<FloatingPointType> operator*(const cpp_double_fp_backend<FloatingPointType>& a, const FloatingPointType& b);
cpp_double_float<FloatingPointType> operator*(const cpp_double_float<FloatingPointType>& a, const FloatingPointType& b);
template <typename FloatingPointType>
cpp_double_fp_backend<FloatingPointType> operator/(const cpp_double_fp_backend<FloatingPointType>& a, const FloatingPointType& b);
cpp_double_float<FloatingPointType> operator/(const cpp_double_float<FloatingPointType>& a, const FloatingPointType& b);
template <typename FloatingPointType>
inline bool operator<(const cpp_double_fp_backend<FloatingPointType>& a, const cpp_double_fp_backend<FloatingPointType>& b);
inline bool operator<(const cpp_double_float<FloatingPointType>& a, const cpp_double_float<FloatingPointType>& b);
template <typename FloatingPointType>
inline bool operator<=(const cpp_double_fp_backend<FloatingPointType>& a, const cpp_double_fp_backend<FloatingPointType>& b);
inline bool operator<=(const cpp_double_float<FloatingPointType>& a, const cpp_double_float<FloatingPointType>& b);
template <typename FloatingPointType>
inline bool operator==(const cpp_double_fp_backend<FloatingPointType>& a, const cpp_double_fp_backend<FloatingPointType>& b);
inline bool operator==(const cpp_double_float<FloatingPointType>& a, const cpp_double_float<FloatingPointType>& b);
template <typename FloatingPointType>
inline bool operator!=(const cpp_double_fp_backend<FloatingPointType>& a, const cpp_double_fp_backend<FloatingPointType>& b);
inline bool operator!=(const cpp_double_float<FloatingPointType>& a, const cpp_double_float<FloatingPointType>& b);
template <typename FloatingPointType>
inline bool operator>=(const cpp_double_fp_backend<FloatingPointType>& a, const cpp_double_fp_backend<FloatingPointType>& b);
inline bool operator>=(const cpp_double_float<FloatingPointType>& a, const cpp_double_float<FloatingPointType>& b);
template <typename FloatingPointType>
inline bool operator>(const cpp_double_fp_backend<FloatingPointType>& a, const cpp_double_fp_backend<FloatingPointType>& b);
inline bool operator>(const cpp_double_float<FloatingPointType>& a, const cpp_double_float<FloatingPointType>& b);
template <typename FloatingPointType>
void eval_add(cpp_double_fp_backend<FloatingPointType>& result, const cpp_double_fp_backend<FloatingPointType>& x);
void eval_add(cpp_double_float<FloatingPointType>& result, const cpp_double_float<FloatingPointType>& x);
template <typename FloatingPointType>
void eval_subtract(cpp_double_fp_backend<FloatingPointType>& result, const cpp_double_fp_backend<FloatingPointType>& x);
void eval_subtract(cpp_double_float<FloatingPointType>& result, const cpp_double_float<FloatingPointType>& x);
template <typename FloatingPointType>
void eval_multiply(cpp_double_fp_backend<FloatingPointType>& result, const cpp_double_fp_backend<FloatingPointType>& x);
void eval_multiply(cpp_double_float<FloatingPointType>& result, const cpp_double_float<FloatingPointType>& x);
template <typename FloatingPointType>
void eval_divide(cpp_double_fp_backend<FloatingPointType>& result, const cpp_double_fp_backend<FloatingPointType>& x);
void eval_divide(cpp_double_float<FloatingPointType>& result, const cpp_double_float<FloatingPointType>& x);
template <typename FloatingPointType>
void eval_fabs(cpp_double_fp_backend<FloatingPointType>& result, const cpp_double_fp_backend<FloatingPointType>& a);
void eval_fabs(cpp_double_float<FloatingPointType>& result, const cpp_double_float<FloatingPointType>& a);
template <typename FloatingPointType>
void eval_frexp(cpp_double_fp_backend<FloatingPointType>& result, const cpp_double_fp_backend<FloatingPointType>& a, int* v);
void eval_frexp(cpp_double_float<FloatingPointType>& result, const cpp_double_float<FloatingPointType>& a, int* v);
template <typename FloatingPointType>
void eval_ldexp(cpp_double_fp_backend<FloatingPointType>& result, const cpp_double_fp_backend<FloatingPointType>& a, int v);
void eval_ldexp(cpp_double_float<FloatingPointType>& result, const cpp_double_float<FloatingPointType>& a, int v);
template <typename FloatingPointType>
void eval_floor(cpp_double_fp_backend<FloatingPointType>& result, const cpp_double_fp_backend<FloatingPointType>& x);
void eval_floor(cpp_double_float<FloatingPointType>& result, const cpp_double_float<FloatingPointType>& x);
template <typename FloatingPointType>
void eval_ceil(cpp_double_fp_backend<FloatingPointType>& result, const cpp_double_fp_backend<FloatingPointType>& x);
void eval_ceil(cpp_double_float<FloatingPointType>& result, const cpp_double_float<FloatingPointType>& x);
template <typename FloatingPointType>
int eval_fpclassify(const cpp_double_fp_backend<FloatingPointType>& o);
int eval_fpclassify(const cpp_double_float<FloatingPointType>& o);
template <typename FloatingPointType>
void eval_sqrt(cpp_double_fp_backend<FloatingPointType>& result, const cpp_double_fp_backend<FloatingPointType>& o);
void eval_sqrt(cpp_double_float<FloatingPointType>& result, const cpp_double_float<FloatingPointType>& o);
template <typename FloatingPointType,
typename std::enable_if<((detail::is_floating_point_or_float128<FloatingPointType>::value == true) && ((std::numeric_limits<FloatingPointType>::digits10 * 2) < 16))>::type const* = nullptr>
void eval_exp(cpp_double_fp_backend<FloatingPointType>& result, const cpp_double_fp_backend<FloatingPointType>& x);
void eval_exp(cpp_double_float<FloatingPointType>& result, const cpp_double_float<FloatingPointType>& x);
template <typename FloatingPointType,
typename std::enable_if<((detail::is_floating_point_or_float128<FloatingPointType>::value == true) && (((std::numeric_limits<FloatingPointType>::digits10 * 2) >= 16) && ((std::numeric_limits<FloatingPointType>::digits10 * 2) <= 36)))>::type const* = nullptr>
void eval_exp(cpp_double_fp_backend<FloatingPointType>& result, const cpp_double_fp_backend<FloatingPointType>& x);
void eval_exp(cpp_double_float<FloatingPointType>& result, const cpp_double_float<FloatingPointType>& x);
template <typename FloatingPointType,
typename std::enable_if<((detail::is_floating_point_or_float128<FloatingPointType>::value == true) && ((std::numeric_limits<FloatingPointType>::digits10 * 2) > 36))>::type const* = nullptr>
void eval_exp(cpp_double_fp_backend<FloatingPointType>& result, const cpp_double_fp_backend<FloatingPointType>& x);
void eval_exp(cpp_double_float<FloatingPointType>& result, const cpp_double_float<FloatingPointType>& x);
template <typename FloatingPointType>
void eval_log(cpp_double_fp_backend<FloatingPointType>& result, const cpp_double_fp_backend<FloatingPointType>& x);
void eval_log(cpp_double_float<FloatingPointType>& result, const cpp_double_float<FloatingPointType>& x);
template <typename FloatingPointType,
typename R>
typename std::enable_if<std::is_integral<R>::value == true>::type eval_convert_to(R* result, const cpp_double_fp_backend<FloatingPointType>& backend);
typename std::enable_if<std::is_integral<R>::value == true>::type eval_convert_to(R* result, const cpp_double_float<FloatingPointType>& backend);
template <typename FloatingPointType,
typename R>
typename std::enable_if<std::is_integral<R>::value == false>::type eval_convert_to(R* result, const cpp_double_fp_backend<FloatingPointType>& backend);
typename std::enable_if<std::is_integral<R>::value == false>::type eval_convert_to(R* result, const cpp_double_float<FloatingPointType>& backend);
template <typename FloatingPointType,
typename char_type,
typename traits_type>
std::basic_ostream<char_type, traits_type>& operator<<(std::basic_ostream<char_type, traits_type>& os,
const cpp_double_fp_backend<FloatingPointType>& f);
const cpp_double_float<FloatingPointType>& f);
template <typename FloatingPointType>
std::size_t hash_value(const cpp_double_fp_backend<FloatingPointType>& a);
std::size_t hash_value(const cpp_double_float<FloatingPointType>& a);
template <typename FloatingPointType>
cpp_double_fp_backend<FloatingPointType> fabs(const cpp_double_fp_backend<FloatingPointType>& a);
cpp_double_float<FloatingPointType> fabs(const cpp_double_float<FloatingPointType>& a);
}}} // namespace boost::multiprecision::backends
namespace boost { namespace math {
template <typename FloatingPointType>
int(fpclassify)(const boost::multiprecision::backends::cpp_double_fp_backend<FloatingPointType>& o);
int(fpclassify)(const boost::multiprecision::backends::cpp_double_float<FloatingPointType>& o);
}} // namespace boost::math
@@ -163,14 +163,14 @@ namespace std {
template <typename FloatingPointType,
const boost::multiprecision::expression_template_option ExpressionTemplatesOption>
class numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_fp_backend<FloatingPointType>, ExpressionTemplatesOption> >;
class numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<FloatingPointType>, ExpressionTemplatesOption> >;
} // namespace std
namespace boost { namespace multiprecision {
template <typename FloatingPointType>
struct number_category<backends::cpp_double_fp_backend<FloatingPointType> >
struct number_category<backends::cpp_double_float<FloatingPointType> >
: public std::integral_constant<int, number_kind_floating_point>
{};
@@ -194,7 +194,7 @@ template <typename FloatingPointType>
struct exact_arithmetic
{
// The exact_arithmetic<> struct implements extended precision
// techniques that are used in cpp_double_fp_backend and cpp_quad_float.
// techniques that are used in cpp_double_float and cpp_quad_float.
static_assert(detail::is_floating_point_or_float128<FloatingPointType>::value == true,
"Error: exact_arithmetic<> invoked with unknown floating-point type");
@@ -351,11 +351,11 @@ struct exact_arithmetic
// Interesting: when we set digits = 2 * <digits of underlying type>
// then this extra normalize, to work with DecomposedReal guard_bits
// needs the subtraction of 2 here.
if ((e1 - e2) > cpp_double_fp_backend<float_type>::my_digits - 2)
if ((e1 - e2) > cpp_double_float<float_type>::my_digits - 2)
{
p.second = 0;
}
// ... maybe even better would be to zero all the bits further away than cpp_double_fp_backend<float_type>>::digits away
// ... maybe even better would be to zero all the bits further away than cpp_double_float<float_type>>::digits away
// not only when entire p.second is too far.
// FIXME - currently I have no idea how to implement this efficiently. But for debugging maybe even the super slow (with frexp, ldexp) implementation will help in edge cases...
// best would be doing & operation on a bitmask..... But can we make sure that would work on all architectures?
@@ -456,12 +456,12 @@ struct exact_arithmetic
} // namespace detail
// A cpp_double_fp_backend is represented by an unevaluated sum of two floating-point
// A cpp_double_float is represented by an unevaluated sum of two floating-point
// units (say a0 and a1) which satisfy |a1| <= (1 / 2) * ulp(a0).
// The type of the floating-point constituents should adhere to IEEE754.
template <typename FloatingPointType>
class cpp_double_fp_backend
class cpp_double_float
{
public:
using float_type = FloatingPointType;
@@ -485,27 +485,27 @@ class cpp_double_fp_backend
"Error: floating-point constituent does not have wide enough exponent range");
// Default constructor.
cpp_double_fp_backend() {}
cpp_double_float() {}
// Copy constructor.
constexpr cpp_double_fp_backend(const cpp_double_fp_backend& other) : data(other.data) {}
constexpr cpp_double_float(const cpp_double_float& other) : data(other.data) {}
// Constructors from other floating-point types.
template <typename OtherFloatType,
typename std::enable_if<(detail::is_floating_point_or_float128<OtherFloatType>::value == true) && (std::numeric_limits<OtherFloatType>::digits <= std::numeric_limits<float_type>::digits)>::type const* = nullptr>
constexpr cpp_double_fp_backend(const OtherFloatType& f) : data(std::make_pair(f, (float_type)0)) {}
constexpr cpp_double_float(const OtherFloatType& f) : data(std::make_pair(f, (float_type)0)) {}
template <typename OtherFloatType,
typename std::enable_if<((detail::is_floating_point_or_float128<OtherFloatType>::value == true) && (std::numeric_limits<OtherFloatType>::digits > std::numeric_limits<float_type>::digits))>::type const* = nullptr>
constexpr cpp_double_fp_backend(const OtherFloatType& f)
constexpr cpp_double_float(const OtherFloatType& f)
: data(std::make_pair(static_cast<float_type>(f),
static_cast<float_type>(f - (OtherFloatType) static_cast<float_type>(f)))) {}
// Constructor from other cpp_double_fp_backend<> objects.
// Constructor from other cpp_double_float<> objects.
template <typename OtherFloatType,
typename std::enable_if<((detail::is_floating_point_or_float128<OtherFloatType>::value == true) && (std::is_same<FloatingPointType, OtherFloatType>::value == false))>::type const* = nullptr>
cpp_double_fp_backend(const cpp_double_fp_backend<OtherFloatType>& a)
: cpp_double_fp_backend(a.first())
cpp_double_float(const cpp_double_float<OtherFloatType>& a)
: cpp_double_float(a.first())
{
// TBD: Maybe specialize this constructor for cases either wider or less wide.
*this += a.second();
@@ -514,12 +514,12 @@ class cpp_double_fp_backend
// Constructors from integers
template <typename IntegralType,
typename std::enable_if<((std::is_integral<IntegralType>::value == true) && (std::numeric_limits<IntegralType>::digits <= std::numeric_limits<FloatingPointType>::digits))>::type const* = nullptr>
constexpr cpp_double_fp_backend(const IntegralType& f) : data(std::make_pair(static_cast<float_type>(f), (float_type)0)) {}
constexpr cpp_double_float(const IntegralType& f) : data(std::make_pair(static_cast<float_type>(f), (float_type)0)) {}
// Constructors from integers which hold more information than *this can contain
template <typename UnsignedIntegralType,
typename std::enable_if<((std::is_integral<UnsignedIntegralType>::value == true) && (std::is_unsigned<UnsignedIntegralType>::value == true) && (std::numeric_limits<UnsignedIntegralType>::digits > std::numeric_limits<float_type>::digits))>::type const* = nullptr>
cpp_double_fp_backend(UnsignedIntegralType u)
cpp_double_float(UnsignedIntegralType u)
{
constexpr int MantissaBits = std::numeric_limits<float_type>::digits - 1;
@@ -545,28 +545,28 @@ class cpp_double_fp_backend
template <typename SignedIntegralType,
typename std::enable_if<((std::is_integral<SignedIntegralType>::value == true) && (std::is_signed<SignedIntegralType>::value == true) && (std::numeric_limits<SignedIntegralType>::digits + 1 > std::numeric_limits<float_type>::digits))>::type const* = nullptr>
cpp_double_fp_backend(SignedIntegralType n) : cpp_double_fp_backend(static_cast<typename std::make_unsigned<SignedIntegralType>::type>(std::abs(n)))
cpp_double_float(SignedIntegralType n) : cpp_double_float(static_cast<typename std::make_unsigned<SignedIntegralType>::type>(std::abs(n)))
{
if (n < 0)
*this = -*this;
}
constexpr cpp_double_fp_backend(const float_type& a, const float_type& b) : data(std::make_pair(a, b)) {}
constexpr cpp_double_fp_backend(const std::pair<float_type, float_type>& p) : data(p) {}
constexpr cpp_double_float(const float_type& a, const float_type& b) : data(std::make_pair(a, b)) {}
constexpr cpp_double_float(const std::pair<float_type, float_type>& p) : data(p) {}
cpp_double_fp_backend(const std::string& str)
cpp_double_float(const std::string& str)
{
boost::multiprecision::detail::convert_from_string(*this, str.c_str());
}
cpp_double_fp_backend(const char* pstr)
cpp_double_float(const char* pstr)
{
boost::multiprecision::detail::convert_from_string(*this, pstr);
}
constexpr cpp_double_fp_backend(cpp_double_fp_backend&& other) : data(other.data) {}
constexpr cpp_double_float(cpp_double_float&& other) : data(other.data) {}
~cpp_double_fp_backend() {}
~cpp_double_float() {}
std::size_t hash() const
{
@@ -574,7 +574,7 @@ class cpp_double_fp_backend
// hash the charactgers in the scientific string.
// TBD: Is there a faster or more simple hash method?
const std::string str_to_hash = str(cpp_double_fp_backend::my_digits10, std::ios::scientific);
const std::string str_to_hash = str(cpp_double_float::my_digits10, std::ios::scientific);
std::size_t result = 0;
@@ -587,8 +587,8 @@ class cpp_double_fp_backend
// Methods
constexpr bool is_neg() const { return (data.first < 0); }
bool is_zero() const { return (compare(cpp_double_fp_backend(0U)) == 0); }
bool is_one() const { return (compare(cpp_double_fp_backend(1U)) == 0); }
bool is_zero() const { return (compare(cpp_double_float(0U)) == 0); }
bool is_one() const { return (compare(cpp_double_float(1U)) == 0); }
void negate()
{
@@ -615,7 +615,7 @@ class cpp_double_fp_backend
}
// Assignment operators.
cpp_double_fp_backend& operator=(const cpp_double_fp_backend& other)
cpp_double_float& operator=(const cpp_double_float& other)
{
if (this != &other)
{
@@ -625,7 +625,7 @@ class cpp_double_fp_backend
return *this;
}
cpp_double_fp_backend& operator=(cpp_double_fp_backend&& other)
cpp_double_float& operator=(cpp_double_float&& other)
{
data = other.data;
@@ -633,9 +633,9 @@ class cpp_double_fp_backend
}
// Non-member add/sub/mul/div with constituent type.
friend cpp_double_fp_backend operator+(const cpp_double_fp_backend& a, const float_type& b)
friend cpp_double_float operator+(const cpp_double_float& a, const float_type& b)
{
using other_cpp_double_float_type = cpp_double_fp_backend<float_type>;
using other_cpp_double_float_type = cpp_double_float<float_type>;
typename other_cpp_double_float_type::rep_type s = other_cpp_double_float_type::arithmetic::sum(a.first(), b);
@@ -645,9 +645,9 @@ class cpp_double_fp_backend
return other_cpp_double_float_type(s);
}
friend cpp_double_fp_backend operator-(const cpp_double_fp_backend& a, const float_type& b)
friend cpp_double_float operator-(const cpp_double_float& a, const float_type& b)
{
using other_cpp_double_float_type = cpp_double_fp_backend<float_type>;
using other_cpp_double_float_type = cpp_double_float<float_type>;
typename other_cpp_double_float_type::rep_type s = other_cpp_double_float_type::arithmetic::difference(a.first(), b);
@@ -657,9 +657,9 @@ class cpp_double_fp_backend
return other_cpp_double_float_type(s);
}
friend cpp_double_fp_backend operator*(const cpp_double_fp_backend& a, const float_type& b)
friend cpp_double_float operator*(const cpp_double_float& a, const float_type& b)
{
using other_cpp_double_float_type = cpp_double_fp_backend<float_type>;
using other_cpp_double_float_type = cpp_double_float<float_type>;
typename other_cpp_double_float_type::rep_type p = other_cpp_double_float_type::arithmetic::product(a.first(), b);
@@ -676,9 +676,9 @@ class cpp_double_fp_backend
return other_cpp_double_float_type(p);
}
friend cpp_double_fp_backend operator/(const cpp_double_fp_backend& a, const float_type& b)
friend cpp_double_float operator/(const cpp_double_float& a, const float_type& b)
{
using other_cpp_double_float_type = cpp_double_fp_backend<float_type>;
using other_cpp_double_float_type = cpp_double_float<float_type>;
typename other_cpp_double_float_type::rep_type p, q, s;
@@ -697,29 +697,29 @@ class cpp_double_fp_backend
}
// Unary add/sub/mul/div with constituent part.
cpp_double_fp_backend& operator+=(const float_type& a)
cpp_double_float& operator+=(const float_type& a)
{
*this = *this + a;
return *this;
}
cpp_double_fp_backend& operator-=(const float_type& a)
cpp_double_float& operator-=(const float_type& a)
{
*this = *this - a;
return *this;
}
cpp_double_fp_backend& operator*=(const float_type& a)
cpp_double_float& operator*=(const float_type& a)
{
*this = *this * a;
return *this;
}
cpp_double_fp_backend& operator/=(const float_type& a)
cpp_double_float& operator/=(const float_type& a)
{
*this = *this / a;
return *this;
}
// Unary add/sub/mul/div.
cpp_double_fp_backend& operator+=(const cpp_double_fp_backend& other)
cpp_double_float& operator+=(const cpp_double_float& other)
{
const rep_type t = arithmetic::sum(second(), other.second());
@@ -739,7 +739,7 @@ class cpp_double_fp_backend
return *this;
}
cpp_double_fp_backend& operator-=(const cpp_double_fp_backend& other)
cpp_double_float& operator-=(const cpp_double_float& other)
{
const rep_type t = arithmetic::difference(second(), other.second());
data = arithmetic::difference(first(), other.first());
@@ -759,7 +759,7 @@ class cpp_double_fp_backend
return *this;
}
cpp_double_fp_backend& operator*=(const cpp_double_fp_backend& other)
cpp_double_float& operator*=(const cpp_double_float& other)
{
rep_type tmp = arithmetic::product(data.first, other.data.first);
@@ -770,7 +770,7 @@ class cpp_double_fp_backend
return *this;
}
cpp_double_fp_backend& operator/=(const cpp_double_fp_backend& other)
cpp_double_float& operator/=(const cpp_double_float& other)
{
rep_type p;
@@ -786,7 +786,7 @@ class cpp_double_fp_backend
return *this;
}
cpp_double_fp_backend r = *this - (other * p.first);
cpp_double_float r = *this - (other * p.first);
p.second = r.first() / other.first();
r -= other * p.second;
@@ -802,32 +802,32 @@ class cpp_double_fp_backend
return *this;
}
cpp_double_fp_backend operator++(int)
cpp_double_float operator++(int)
{
cpp_double_fp_backend t(*this);
cpp_double_float t(*this);
++*this;
return t;
}
cpp_double_fp_backend operator--(int)
cpp_double_float operator--(int)
{
cpp_double_fp_backend t(*this);
cpp_double_float t(*this);
--*this;
return t;
}
cpp_double_fp_backend& operator++() { return *this += cpp_double_fp_backend<float_type>(float_type(1.0F)); }
cpp_double_fp_backend& operator--() { return *this -= cpp_double_fp_backend<float_type>(float_type(1.0F)); }
cpp_double_float& operator++() { return *this += cpp_double_float<float_type>(float_type(1.0F)); }
cpp_double_float& operator--() { return *this -= cpp_double_float<float_type>(float_type(1.0F)); }
cpp_double_fp_backend operator-() const
cpp_double_float operator-() const
{
cpp_double_fp_backend v(*this);
cpp_double_float v(*this);
v.negate();
return v;
}
// Helper functions
static cpp_double_fp_backend pown(const cpp_double_fp_backend& x, int p)
static cpp_double_float pown(const cpp_double_float& x, int p)
{
using local_float_type = cpp_double_fp_backend;
using local_float_type = cpp_double_float;
local_float_type result;
@@ -872,7 +872,7 @@ class cpp_double_fp_backend
return result;
}
void swap(cpp_double_fp_backend& other)
void swap(cpp_double_float& other)
{
rep_type tmp = data;
@@ -881,7 +881,7 @@ class cpp_double_fp_backend
other.data = tmp;
}
int compare(const cpp_double_fp_backend& other) const
int compare(const cpp_double_float& other) const
{
// Return 1 for *this > other, -1 for *this < other, 0 for *this = other.
return (first() > other.first()) ? 1 : (first() < other.first()) ? -1
@@ -893,7 +893,7 @@ class cpp_double_fp_backend
std::string str(std::streamsize number_of_digits, const std::ios::fmtflags format_flags) const
{
if (number_of_digits == 0)
number_of_digits = cpp_double_fp_backend::my_digits10;
number_of_digits = cpp_double_float::my_digits10;
const std::string my_str = boost::multiprecision::detail::convert_to_string(*this, number_of_digits, format_flags);
@@ -909,9 +909,9 @@ class cpp_double_fp_backend
}
int order10() const { return (int)(float(order02()) * 0.301F); }
bool small_arg() const { return (order10() < (-my_digits10 / 6)); }
bool near_one() const { return cpp_double_fp_backend(fabs(cpp_double_fp_backend(1U) - *this)).small_arg(); }
bool near_one() const { return cpp_double_float(fabs(cpp_double_float(1U) - *this)).small_arg(); }
static cpp_double_fp_backend my_value_max() noexcept
static cpp_double_float my_value_max() noexcept
{
using std::ldexp;
using std::sqrt;
@@ -920,20 +920,20 @@ class cpp_double_fp_backend
using boost::multiprecision::sqrt;
#endif
return cpp_double_fp_backend(arithmetic::fast_sum((std::numeric_limits<float_type>::max)() * (1.0F - 1.5F * sqrt(std::numeric_limits<float_type>::epsilon())), ldexp((std::numeric_limits<float_type>::max)(), -(std::numeric_limits<float_type>::digits + 1))));
return cpp_double_float(arithmetic::fast_sum((std::numeric_limits<float_type>::max)() * (1.0F - 1.5F * sqrt(std::numeric_limits<float_type>::epsilon())), ldexp((std::numeric_limits<float_type>::max)(), -(std::numeric_limits<float_type>::digits + 1))));
}
static cpp_double_fp_backend my_value_min() noexcept
static cpp_double_float my_value_min() noexcept
{
using std::ldexp;
#if defined(BOOST_MATH_USE_FLOAT128)
using boost::multiprecision::ldexp;
#endif
return cpp_double_fp_backend(ldexp(float_type(1), my_min_exponent));
return cpp_double_float(ldexp(float_type(1), my_min_exponent));
}
static cpp_double_fp_backend my_value_eps() noexcept
static cpp_double_float my_value_eps() noexcept
{
using std::ldexp;
#if defined(BOOST_MATH_USE_FLOAT128)
@@ -941,18 +941,18 @@ class cpp_double_fp_backend
#endif
// TBD: Need a better value here.
return []() -> cpp_double_fp_backend {
cpp_double_fp_backend result;
return []() -> cpp_double_float {
cpp_double_float result;
eval_ldexp(result, cpp_double_fp_backend(1), 4 - my_digits);
eval_ldexp(result, cpp_double_float(1), 4 - my_digits);
return result;
}();
}
static constexpr cpp_double_fp_backend my_value_nan() noexcept
static constexpr cpp_double_float my_value_nan() noexcept
{
return cpp_double_fp_backend(std::numeric_limits<float_type>::quiet_NaN());
return cpp_double_float(std::numeric_limits<float_type>::quiet_NaN());
}
private:
@@ -960,58 +960,58 @@ class cpp_double_fp_backend
template <typename OtherFloatingPointType,
typename std::enable_if<((detail::is_floating_point_or_float128<OtherFloatingPointType>::value == true) && ((std::numeric_limits<FloatingPointType>::digits10 * 2) < 16))>::type const*>
friend void eval_exp(cpp_double_fp_backend<OtherFloatingPointType>& result, const cpp_double_fp_backend<OtherFloatingPointType>& x);
friend void eval_exp(cpp_double_float<OtherFloatingPointType>& result, const cpp_double_float<OtherFloatingPointType>& x);
template <typename OtherFloatingPointType,
typename std::enable_if<((detail::is_floating_point_or_float128<OtherFloatingPointType>::value == true) && (((std::numeric_limits<FloatingPointType>::digits10 * 2) >= 16) && ((std::numeric_limits<FloatingPointType>::digits10 * 2) <= 36)))>::type const*>
friend void eval_exp(cpp_double_fp_backend<OtherFloatingPointType>& result, const cpp_double_fp_backend<OtherFloatingPointType>& x);
friend void eval_exp(cpp_double_float<OtherFloatingPointType>& result, const cpp_double_float<OtherFloatingPointType>& x);
template <typename OtherFloatingPointType,
typename std::enable_if<((detail::is_floating_point_or_float128<OtherFloatingPointType>::value == true) && ((std::numeric_limits<FloatingPointType>::digits10 * 2) > 36))>::type const*>
friend void eval_exp(cpp_double_fp_backend<OtherFloatingPointType>& result, const cpp_double_fp_backend<OtherFloatingPointType>& x);
friend void eval_exp(cpp_double_float<OtherFloatingPointType>& result, const cpp_double_float<OtherFloatingPointType>& x);
};
template <typename FloatingPointType>
constexpr int cpp_double_fp_backend<FloatingPointType>::my_digits;
constexpr int cpp_double_float<FloatingPointType>::my_digits;
template <typename FloatingPointType>
constexpr int cpp_double_fp_backend<FloatingPointType>::my_digits10;
constexpr int cpp_double_float<FloatingPointType>::my_digits10;
template <typename FloatingPointType>
constexpr int cpp_double_fp_backend<FloatingPointType>::my_max_digits10;
constexpr int cpp_double_float<FloatingPointType>::my_max_digits10;
template <typename FloatingPointType>
constexpr int cpp_double_fp_backend<FloatingPointType>::my_max_exponent;
constexpr int cpp_double_float<FloatingPointType>::my_max_exponent;
template <typename FloatingPointType>
constexpr int cpp_double_fp_backend<FloatingPointType>::my_min_exponent;
constexpr int cpp_double_float<FloatingPointType>::my_min_exponent;
template <typename FloatingPointType>
constexpr int cpp_double_fp_backend<FloatingPointType>::my_max_exponent10;
constexpr int cpp_double_float<FloatingPointType>::my_max_exponent10;
template <typename FloatingPointType>
constexpr int cpp_double_fp_backend<FloatingPointType>::my_min_exponent10;
constexpr int cpp_double_float<FloatingPointType>::my_min_exponent10;
template <typename FloatingPointType>
inline cpp_double_fp_backend<FloatingPointType> operator+(const cpp_double_fp_backend<FloatingPointType>& a, const cpp_double_fp_backend<FloatingPointType>& b) { return cpp_double_fp_backend<FloatingPointType>(a) += b; }
inline cpp_double_float<FloatingPointType> operator+(const cpp_double_float<FloatingPointType>& a, const cpp_double_float<FloatingPointType>& b) { return cpp_double_float<FloatingPointType>(a) += b; }
template <typename FloatingPointType>
inline cpp_double_fp_backend<FloatingPointType> operator-(const cpp_double_fp_backend<FloatingPointType>& a, const cpp_double_fp_backend<FloatingPointType>& b) { return cpp_double_fp_backend<FloatingPointType>(a) -= b; }
inline cpp_double_float<FloatingPointType> operator-(const cpp_double_float<FloatingPointType>& a, const cpp_double_float<FloatingPointType>& b) { return cpp_double_float<FloatingPointType>(a) -= b; }
template <typename FloatingPointType>
inline cpp_double_fp_backend<FloatingPointType> operator*(const cpp_double_fp_backend<FloatingPointType>& a, const cpp_double_fp_backend<FloatingPointType>& b) { return cpp_double_fp_backend<FloatingPointType>(a) *= b; }
inline cpp_double_float<FloatingPointType> operator*(const cpp_double_float<FloatingPointType>& a, const cpp_double_float<FloatingPointType>& b) { return cpp_double_float<FloatingPointType>(a) *= b; }
template <typename FloatingPointType>
inline cpp_double_fp_backend<FloatingPointType> operator/(const cpp_double_fp_backend<FloatingPointType>& a, const cpp_double_fp_backend<FloatingPointType>& b) { return cpp_double_fp_backend<FloatingPointType>(a) /= b; }
inline cpp_double_float<FloatingPointType> operator/(const cpp_double_float<FloatingPointType>& a, const cpp_double_float<FloatingPointType>& b) { return cpp_double_float<FloatingPointType>(a) /= b; }
template <typename FloatingPointType>
inline bool operator<(const cpp_double_fp_backend<FloatingPointType>& a, const cpp_double_fp_backend<FloatingPointType>& b) { return (a.compare(b) < 0); }
inline bool operator<(const cpp_double_float<FloatingPointType>& a, const cpp_double_float<FloatingPointType>& b) { return (a.compare(b) < 0); }
template <typename FloatingPointType>
inline bool operator<=(const cpp_double_fp_backend<FloatingPointType>& a, const cpp_double_fp_backend<FloatingPointType>& b) { return (a.compare(b) <= 0); }
inline bool operator<=(const cpp_double_float<FloatingPointType>& a, const cpp_double_float<FloatingPointType>& b) { return (a.compare(b) <= 0); }
template <typename FloatingPointType>
inline bool operator==(const cpp_double_fp_backend<FloatingPointType>& a, const cpp_double_fp_backend<FloatingPointType>& b) { return (a.compare(b) == 0); }
inline bool operator==(const cpp_double_float<FloatingPointType>& a, const cpp_double_float<FloatingPointType>& b) { return (a.compare(b) == 0); }
template <typename FloatingPointType>
inline bool operator!=(const cpp_double_fp_backend<FloatingPointType>& a, const cpp_double_fp_backend<FloatingPointType>& b) { return (a.compare(b) != 0); }
inline bool operator!=(const cpp_double_float<FloatingPointType>& a, const cpp_double_float<FloatingPointType>& b) { return (a.compare(b) != 0); }
template <typename FloatingPointType>
inline bool operator>=(const cpp_double_fp_backend<FloatingPointType>& a, const cpp_double_fp_backend<FloatingPointType>& b) { return (a.compare(b) >= 0); }
inline bool operator>=(const cpp_double_float<FloatingPointType>& a, const cpp_double_float<FloatingPointType>& b) { return (a.compare(b) >= 0); }
template <typename FloatingPointType>
inline bool operator>(const cpp_double_fp_backend<FloatingPointType>& a, const cpp_double_fp_backend<FloatingPointType>& b) { return (a.compare(b) > 0); }
inline bool operator>(const cpp_double_float<FloatingPointType>& a, const cpp_double_float<FloatingPointType>& b) { return (a.compare(b) > 0); }
// -- Input/Output Streaming
template <typename FloatingPointType, typename char_type, typename traits_type>
std::basic_ostream<char_type, traits_type>&
operator<<(std::basic_ostream<char_type, traits_type>& os, const cpp_double_fp_backend<FloatingPointType>& f)
operator<<(std::basic_ostream<char_type, traits_type>& os, const cpp_double_float<FloatingPointType>& f)
{
const std::string str_result = f.str(os.precision(), os.flags());
@@ -1020,7 +1020,7 @@ operator<<(std::basic_ostream<char_type, traits_type>& os, const cpp_double_fp_b
template <typename FloatingPointType, typename char_type, typename traits_type>
std::basic_istream<char_type, traits_type>&
operator>>(std::basic_istream<char_type, traits_type>& is, cpp_double_fp_backend<FloatingPointType>& f)
operator>>(std::basic_istream<char_type, traits_type>& is, cpp_double_float<FloatingPointType>& f)
{
std::string str;
is >> str;
@@ -1029,16 +1029,16 @@ operator>>(std::basic_istream<char_type, traits_type>& is, cpp_double_fp_backend
}
template <typename FloatingPointType>
void eval_add(cpp_double_fp_backend<FloatingPointType>& result, const cpp_double_fp_backend<FloatingPointType>& x) { result += x; }
void eval_add(cpp_double_float<FloatingPointType>& result, const cpp_double_float<FloatingPointType>& x) { result += x; }
template <typename FloatingPointType>
void eval_subtract(cpp_double_fp_backend<FloatingPointType>& result, const cpp_double_fp_backend<FloatingPointType>& x) { result -= x; }
void eval_subtract(cpp_double_float<FloatingPointType>& result, const cpp_double_float<FloatingPointType>& x) { result -= x; }
template <typename FloatingPointType>
void eval_multiply(cpp_double_fp_backend<FloatingPointType>& result, const cpp_double_fp_backend<FloatingPointType>& x) { result *= x; }
void eval_multiply(cpp_double_float<FloatingPointType>& result, const cpp_double_float<FloatingPointType>& x) { result *= x; }
template <typename FloatingPointType>
void eval_divide(cpp_double_fp_backend<FloatingPointType>& result, const cpp_double_fp_backend<FloatingPointType>& x) { result /= x; }
void eval_divide(cpp_double_float<FloatingPointType>& result, const cpp_double_float<FloatingPointType>& x) { result /= x; }
template <typename FloatingPointType>
void eval_fabs(cpp_double_fp_backend<FloatingPointType>& result, const cpp_double_fp_backend<FloatingPointType>& a)
void eval_fabs(cpp_double_float<FloatingPointType>& result, const cpp_double_float<FloatingPointType>& a)
{
result = a;
@@ -1049,7 +1049,7 @@ void eval_fabs(cpp_double_fp_backend<FloatingPointType>& result, const cpp_doubl
}
template <typename FloatingPointType>
void eval_frexp(cpp_double_fp_backend<FloatingPointType>& result, const cpp_double_fp_backend<FloatingPointType>& a, int* v)
void eval_frexp(cpp_double_float<FloatingPointType>& result, const cpp_double_float<FloatingPointType>& a, int* v)
{
using std::frexp;
using std::ldexp;
@@ -1059,24 +1059,24 @@ void eval_frexp(cpp_double_fp_backend<FloatingPointType>& result, const cpp_doub
}
template <typename FloatingPointType>
void eval_ldexp(cpp_double_fp_backend<FloatingPointType>& result, const cpp_double_fp_backend<FloatingPointType>& a, int v)
void eval_ldexp(cpp_double_float<FloatingPointType>& result, const cpp_double_float<FloatingPointType>& a, int v)
{
using std::ldexp;
typename cpp_double_fp_backend<FloatingPointType>::rep_type z =
typename cpp_double_float<FloatingPointType>::rep_type z =
std::make_pair(
ldexp(a.crep().first, v),
ldexp(a.crep().second, v));
cpp_double_fp_backend<FloatingPointType>::arithmetic::normalize(z);
cpp_double_float<FloatingPointType>::arithmetic::normalize(z);
result.rep() = z;
}
template <typename FloatingPointType>
void eval_floor(cpp_double_fp_backend<FloatingPointType>& result, const cpp_double_fp_backend<FloatingPointType>& x)
void eval_floor(cpp_double_float<FloatingPointType>& result, const cpp_double_float<FloatingPointType>& x)
{
using double_float_type = cpp_double_fp_backend<FloatingPointType>;
using double_float_type = cpp_double_float<FloatingPointType>;
using std::floor;
@@ -1097,7 +1097,7 @@ void eval_floor(cpp_double_fp_backend<FloatingPointType>& result, const cpp_doub
}
template <typename FloatingPointType>
void eval_ceil(cpp_double_fp_backend<FloatingPointType>& result, const cpp_double_fp_backend<FloatingPointType>& x)
void eval_ceil(cpp_double_float<FloatingPointType>& result, const cpp_double_float<FloatingPointType>& x)
{
// Compute -floor(-x);
eval_floor(result, -x);
@@ -1106,15 +1106,15 @@ void eval_ceil(cpp_double_fp_backend<FloatingPointType>& result, const cpp_doubl
}
template <typename FloatingPointType>
int eval_fpclassify(const cpp_double_fp_backend<FloatingPointType>& o)
int eval_fpclassify(const cpp_double_float<FloatingPointType>& o)
{
return (int)(boost::math::fpclassify)(o.crep().first);
}
template <typename FloatingPointType>
void eval_sqrt(cpp_double_fp_backend<FloatingPointType>& result, const cpp_double_fp_backend<FloatingPointType>& o)
void eval_sqrt(cpp_double_float<FloatingPointType>& result, const cpp_double_float<FloatingPointType>& o)
{
using local_float_type = typename cpp_double_fp_backend<FloatingPointType>::float_type;
using local_float_type = typename cpp_double_float<FloatingPointType>::float_type;
using std::sqrt;
@@ -1157,7 +1157,7 @@ void eval_sqrt(cpp_double_fp_backend<FloatingPointType>& result, const cpp_doubl
template <typename FloatingPointType,
typename std::enable_if<((detail::is_floating_point_or_float128<FloatingPointType>::value == true) && ((std::numeric_limits<FloatingPointType>::digits10 * 2) < 16))>::type const*>
void eval_exp(cpp_double_fp_backend<FloatingPointType>& result, const cpp_double_fp_backend<FloatingPointType>& x)
void eval_exp(cpp_double_float<FloatingPointType>& result, const cpp_double_float<FloatingPointType>& x)
{
const bool x_is_zero = x.is_zero();
@@ -1167,7 +1167,7 @@ void eval_exp(cpp_double_fp_backend<FloatingPointType>& result, const cpp_double
}
else
{
using double_float_type = cpp_double_fp_backend<FloatingPointType>;
using double_float_type = cpp_double_float<FloatingPointType>;
using local_float_type = typename double_float_type::float_type;
// Get a local copy of the argument and force it to be positive.
@@ -1277,7 +1277,7 @@ void eval_exp(cpp_double_fp_backend<FloatingPointType>& result, const cpp_double
template <typename FloatingPointType,
typename std::enable_if<((detail::is_floating_point_or_float128<FloatingPointType>::value == true) && (((std::numeric_limits<FloatingPointType>::digits10 * 2) >= 16) && ((std::numeric_limits<FloatingPointType>::digits10 * 2) <= 36)))>::type const*>
void eval_exp(cpp_double_fp_backend<FloatingPointType>& result, const cpp_double_fp_backend<FloatingPointType>& x)
void eval_exp(cpp_double_float<FloatingPointType>& result, const cpp_double_float<FloatingPointType>& x)
{
const bool x_is_zero = x.is_zero();
@@ -1287,7 +1287,7 @@ void eval_exp(cpp_double_fp_backend<FloatingPointType>& result, const cpp_double
}
else
{
using double_float_type = cpp_double_fp_backend<FloatingPointType>;
using double_float_type = cpp_double_float<FloatingPointType>;
using local_float_type = typename double_float_type::float_type;
// Get a local copy of the argument and force it to be positive.
@@ -1397,7 +1397,7 @@ void eval_exp(cpp_double_fp_backend<FloatingPointType>& result, const cpp_double
template <typename FloatingPointType,
typename std::enable_if<((detail::is_floating_point_or_float128<FloatingPointType>::value == true) && ((std::numeric_limits<FloatingPointType>::digits10 * 2) > 36))>::type const*>
void eval_exp(cpp_double_fp_backend<FloatingPointType>& result, const cpp_double_fp_backend<FloatingPointType>& x)
void eval_exp(cpp_double_float<FloatingPointType>& result, const cpp_double_float<FloatingPointType>& x)
{
const bool x_is_zero = x.is_zero();
@@ -1407,7 +1407,7 @@ void eval_exp(cpp_double_fp_backend<FloatingPointType>& result, const cpp_double
}
else
{
using double_float_type = cpp_double_fp_backend<FloatingPointType>;
using double_float_type = cpp_double_float<FloatingPointType>;
using local_float_type = typename double_float_type::float_type;
// Get a local copy of the argument and force it to be positive.
@@ -1517,9 +1517,9 @@ void eval_exp(cpp_double_fp_backend<FloatingPointType>& result, const cpp_double
}
template <typename FloatingPointType>
void eval_log(cpp_double_fp_backend<FloatingPointType>& result, const cpp_double_fp_backend<FloatingPointType>& x)
void eval_log(cpp_double_float<FloatingPointType>& result, const cpp_double_float<FloatingPointType>& x)
{
using double_float_type = cpp_double_fp_backend<FloatingPointType>;
using double_float_type = cpp_double_float<FloatingPointType>;
if (eval_fpclassify(x) != (int)FP_NORMAL)
{
@@ -1550,7 +1550,7 @@ void eval_log(cpp_double_fp_backend<FloatingPointType>& result, const cpp_double
template <typename FloatingPointType,
typename R>
typename std::enable_if<std::is_integral<R>::value == true>::type eval_convert_to(R* result, const cpp_double_fp_backend<FloatingPointType>& backend)
typename std::enable_if<std::is_integral<R>::value == true>::type eval_convert_to(R* result, const cpp_double_float<FloatingPointType>& backend)
{
// TBD: Does boost::common_type have a C++ 11 replacement?
using c_type = typename boost::common_type<R, FloatingPointType>::type;
@@ -1565,7 +1565,7 @@ typename std::enable_if<std::is_integral<R>::value == true>::type eval_convert_t
if (ct > my_max)
if (!std::is_unsigned<R>::value)
*result = backend.crep().first >= typename cpp_double_fp_backend<FloatingPointType>::float_type(0U) ? (std::numeric_limits<R>::max)() : detail::minus_max<R>();
*result = backend.crep().first >= typename cpp_double_float<FloatingPointType>::float_type(0U) ? (std::numeric_limits<R>::max)() : detail::minus_max<R>();
else
*result = (std::numeric_limits<R>::max)();
else
@@ -1577,16 +1577,16 @@ typename std::enable_if<std::is_integral<R>::value == true>::type eval_convert_t
template <typename FloatingPointType,
typename R>
typename std::enable_if<std::is_integral<R>::value == false>::type eval_convert_to(R* result, const cpp_double_fp_backend<FloatingPointType>& backend)
typename std::enable_if<std::is_integral<R>::value == false>::type eval_convert_to(R* result, const cpp_double_float<FloatingPointType>& backend)
{
*result = R(backend.crep().first);
*result += R(backend.crep().second);
}
template <typename FloatingPointType>
cpp_double_fp_backend<FloatingPointType> fabs(const cpp_double_fp_backend<FloatingPointType>& a)
cpp_double_float<FloatingPointType> fabs(const cpp_double_float<FloatingPointType>& a)
{
using double_float_type = cpp_double_fp_backend<FloatingPointType>;
using double_float_type = cpp_double_float<FloatingPointType>;
double_float_type result;
@@ -1596,18 +1596,18 @@ cpp_double_fp_backend<FloatingPointType> fabs(const cpp_double_fp_backend<Floati
}
template <typename FloatingPointType>
std::size_t hash_value(const cpp_double_fp_backend<FloatingPointType>& a)
std::size_t hash_value(const cpp_double_float<FloatingPointType>& a)
{
return a.hash();
}
} // namespace backends
using cpp_double_float = number<backends::cpp_double_fp_backend<float>>;
using cpp_double_double = number<backends::cpp_double_fp_backend<double>>;
using cpp_double_long_double = number<backends::cpp_double_fp_backend<long double>>;
using cpp_double_float = number<backends::cpp_double_float<float>>;
using cpp_double_double = number<backends::cpp_double_float<double>>;
using cpp_double_long_double = number<backends::cpp_double_float<long double>>;
#ifdef BOOST_MATH_USE_FLOAT128
using cpp_double_float128 = number<backends::cpp_double_fp_backend<float128>>;
using cpp_double_float128 = number<backends::cpp_double_float<float128>>;
#endif
}} // namespace boost::multiprecision
@@ -1615,7 +1615,7 @@ using cpp_double_float128 = number<backends::cpp_double_fp_backend<float128>>
namespace boost { namespace math {
template <typename FloatingPointType>
int(fpclassify)(const boost::multiprecision::backends::cpp_double_fp_backend<FloatingPointType>& o)
int(fpclassify)(const boost::multiprecision::backends::cpp_double_float<FloatingPointType>& o)
{
using std::fpclassify;
@@ -1626,16 +1626,16 @@ int(fpclassify)(const boost::multiprecision::backends::cpp_double_fp_backend<Flo
namespace std {
// Specialization of numeric_limits for boost::multiprecision::number<cpp_double_fp_backend<>>
// Specialization of numeric_limits for boost::multiprecision::number<cpp_double_float<>>
template <typename FloatingPointType,
const boost::multiprecision::expression_template_option ExpressionTemplatesOption>
class numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_fp_backend<FloatingPointType>, ExpressionTemplatesOption> >
class numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<FloatingPointType>, ExpressionTemplatesOption> >
: public std::numeric_limits<FloatingPointType>
{
private:
using base_class_type = std::numeric_limits<FloatingPointType>;
using inner_self_type = boost::multiprecision::backends::cpp_double_fp_backend<FloatingPointType>;
using inner_self_type = boost::multiprecision::backends::cpp_double_float<FloatingPointType>;
using self_type =
boost::multiprecision::number<inner_self_type, ExpressionTemplatesOption>;
@@ -1673,34 +1673,34 @@ class numeric_limits<boost::multiprecision::number<boost::multiprecision::backen
} // namespace std
template <typename FloatingPointType, const boost::multiprecision::expression_template_option ExpressionTemplatesOption>
constexpr bool std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_fp_backend<FloatingPointType>, ExpressionTemplatesOption> >::is_specialized;
constexpr bool std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<FloatingPointType>, ExpressionTemplatesOption> >::is_specialized;
template <typename FloatingPointType, const boost::multiprecision::expression_template_option ExpressionTemplatesOption>
constexpr bool std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_fp_backend<FloatingPointType>, ExpressionTemplatesOption> >::is_signed;
constexpr bool std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<FloatingPointType>, ExpressionTemplatesOption> >::is_signed;
template <typename FloatingPointType, const boost::multiprecision::expression_template_option ExpressionTemplatesOption>
constexpr bool std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_fp_backend<FloatingPointType>, ExpressionTemplatesOption> >::is_integer;
constexpr bool std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<FloatingPointType>, ExpressionTemplatesOption> >::is_integer;
template <typename FloatingPointType, const boost::multiprecision::expression_template_option ExpressionTemplatesOption>
constexpr bool std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_fp_backend<FloatingPointType>, ExpressionTemplatesOption> >::is_exact;
constexpr bool std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<FloatingPointType>, ExpressionTemplatesOption> >::is_exact;
template <typename FloatingPointType, const boost::multiprecision::expression_template_option ExpressionTemplatesOption>
constexpr bool std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_fp_backend<FloatingPointType>, ExpressionTemplatesOption> >::is_bounded;
constexpr bool std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<FloatingPointType>, ExpressionTemplatesOption> >::is_bounded;
template <typename FloatingPointType, const boost::multiprecision::expression_template_option ExpressionTemplatesOption>
constexpr bool std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_fp_backend<FloatingPointType>, ExpressionTemplatesOption> >::is_modulo;
constexpr bool std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<FloatingPointType>, ExpressionTemplatesOption> >::is_modulo;
template <typename FloatingPointType, const boost::multiprecision::expression_template_option ExpressionTemplatesOption>
constexpr bool std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_fp_backend<FloatingPointType>, ExpressionTemplatesOption> >::is_iec559;
constexpr bool std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<FloatingPointType>, ExpressionTemplatesOption> >::is_iec559;
template <typename FloatingPointType, const boost::multiprecision::expression_template_option ExpressionTemplatesOption>
constexpr std::float_denorm_style std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_fp_backend<FloatingPointType>, ExpressionTemplatesOption> >::has_denorm;
constexpr std::float_denorm_style std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<FloatingPointType>, ExpressionTemplatesOption> >::has_denorm;
template <typename FloatingPointType, const boost::multiprecision::expression_template_option ExpressionTemplatesOption>
constexpr int std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_fp_backend<FloatingPointType>, ExpressionTemplatesOption> >::digits;
constexpr int std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<FloatingPointType>, ExpressionTemplatesOption> >::digits;
template <typename FloatingPointType, const boost::multiprecision::expression_template_option ExpressionTemplatesOption>
constexpr int std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_fp_backend<FloatingPointType>, ExpressionTemplatesOption> >::digits10;
constexpr int std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<FloatingPointType>, ExpressionTemplatesOption> >::digits10;
template <typename FloatingPointType, const boost::multiprecision::expression_template_option ExpressionTemplatesOption>
constexpr int std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_fp_backend<FloatingPointType>, ExpressionTemplatesOption> >::max_digits10;
constexpr int std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<FloatingPointType>, ExpressionTemplatesOption> >::max_digits10;
template <typename FloatingPointType, const boost::multiprecision::expression_template_option ExpressionTemplatesOption>
constexpr int std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_fp_backend<FloatingPointType>, ExpressionTemplatesOption> >::max_exponent;
constexpr int std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<FloatingPointType>, ExpressionTemplatesOption> >::max_exponent;
template <typename FloatingPointType, const boost::multiprecision::expression_template_option ExpressionTemplatesOption>
constexpr int std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_fp_backend<FloatingPointType>, ExpressionTemplatesOption> >::min_exponent;
constexpr int std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<FloatingPointType>, ExpressionTemplatesOption> >::min_exponent;
template <typename FloatingPointType, const boost::multiprecision::expression_template_option ExpressionTemplatesOption>
constexpr int std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_fp_backend<FloatingPointType>, ExpressionTemplatesOption> >::max_exponent10;
constexpr int std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<FloatingPointType>, ExpressionTemplatesOption> >::max_exponent10;
template <typename FloatingPointType, const boost::multiprecision::expression_template_option ExpressionTemplatesOption>
constexpr int std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_fp_backend<FloatingPointType>, ExpressionTemplatesOption> >::min_exponent10;
constexpr int std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<FloatingPointType>, ExpressionTemplatesOption> >::min_exponent10;
#endif // BOOST_MP_CPP_DOUBLE_FLOAT_2021_06_05_HPP
+157 -158
View File
@@ -31,89 +31,89 @@
namespace boost { namespace multiprecision { namespace backends {
template <typename FloatingPointType>
class cpp_quad_fp_backend;
class cpp_quad_float;
template <typename FloatingPointType>
inline cpp_quad_fp_backend<FloatingPointType> operator+(const cpp_quad_fp_backend<FloatingPointType>& a, const cpp_quad_fp_backend<FloatingPointType>& b);
inline cpp_quad_float<FloatingPointType> operator+(const cpp_quad_float<FloatingPointType>& a, const cpp_quad_float<FloatingPointType>& b);
template <typename FloatingPointType>
inline cpp_quad_fp_backend<FloatingPointType> operator-(const cpp_quad_fp_backend<FloatingPointType>& a, const cpp_quad_fp_backend<FloatingPointType>& b);
inline cpp_quad_float<FloatingPointType> operator-(const cpp_quad_float<FloatingPointType>& a, const cpp_quad_float<FloatingPointType>& b);
template <typename FloatingPointType>
inline cpp_quad_fp_backend<FloatingPointType> operator*(const cpp_quad_fp_backend<FloatingPointType>& a, const cpp_quad_fp_backend<FloatingPointType>& b);
inline cpp_quad_float<FloatingPointType> operator*(const cpp_quad_float<FloatingPointType>& a, const cpp_quad_float<FloatingPointType>& b);
template <typename FloatingPointType>
inline cpp_quad_fp_backend<FloatingPointType> operator/(const cpp_quad_fp_backend<FloatingPointType>& a, const cpp_quad_fp_backend<FloatingPointType>& b);
inline cpp_quad_float<FloatingPointType> operator/(const cpp_quad_float<FloatingPointType>& a, const cpp_quad_float<FloatingPointType>& b);
template <typename FloatingPointType>
inline cpp_quad_fp_backend<FloatingPointType> operator+(const cpp_quad_fp_backend<FloatingPointType>& a, const FloatingPointType& b);
inline cpp_quad_float<FloatingPointType> operator+(const cpp_quad_float<FloatingPointType>& a, const FloatingPointType& b);
template <typename FloatingPointType>
inline cpp_quad_fp_backend<FloatingPointType> operator-(const cpp_quad_fp_backend<FloatingPointType>& a, const FloatingPointType& b);
inline cpp_quad_float<FloatingPointType> operator-(const cpp_quad_float<FloatingPointType>& a, const FloatingPointType& b);
template <typename FloatingPointType>
inline cpp_quad_fp_backend<FloatingPointType> operator*(const cpp_quad_fp_backend<FloatingPointType>& a, const FloatingPointType& b);
inline cpp_quad_float<FloatingPointType> operator*(const cpp_quad_float<FloatingPointType>& a, const FloatingPointType& b);
template <typename FloatingPointType>
inline cpp_quad_fp_backend<FloatingPointType> operator/(const cpp_quad_fp_backend<FloatingPointType>& a, const FloatingPointType& b);
inline cpp_quad_float<FloatingPointType> operator/(const cpp_quad_float<FloatingPointType>& a, const FloatingPointType& b);
template <typename FloatingPointType>
inline bool operator<(const cpp_quad_fp_backend<FloatingPointType>& a, const cpp_quad_fp_backend<FloatingPointType>& b);
inline bool operator<(const cpp_quad_float<FloatingPointType>& a, const cpp_quad_float<FloatingPointType>& b);
template <typename FloatingPointType>
inline bool operator<=(const cpp_quad_fp_backend<FloatingPointType>& a, const cpp_quad_fp_backend<FloatingPointType>& b);
inline bool operator<=(const cpp_quad_float<FloatingPointType>& a, const cpp_quad_float<FloatingPointType>& b);
template <typename FloatingPointType>
inline bool operator==(const cpp_quad_fp_backend<FloatingPointType>& a, const cpp_quad_fp_backend<FloatingPointType>& b);
inline bool operator==(const cpp_quad_float<FloatingPointType>& a, const cpp_quad_float<FloatingPointType>& b);
template <typename FloatingPointType>
inline bool operator!=(const cpp_quad_fp_backend<FloatingPointType>& a, const cpp_quad_fp_backend<FloatingPointType>& b);
inline bool operator!=(const cpp_quad_float<FloatingPointType>& a, const cpp_quad_float<FloatingPointType>& b);
template <typename FloatingPointType>
inline bool operator>=(const cpp_quad_fp_backend<FloatingPointType>& a, const cpp_quad_fp_backend<FloatingPointType>& b);
inline bool operator>=(const cpp_quad_float<FloatingPointType>& a, const cpp_quad_float<FloatingPointType>& b);
template <typename FloatingPointType>
inline bool operator>(const cpp_quad_fp_backend<FloatingPointType>& a, const cpp_quad_fp_backend<FloatingPointType>& b);
inline bool operator>(const cpp_quad_float<FloatingPointType>& a, const cpp_quad_float<FloatingPointType>& b);
template <typename FloatingPointType>
void eval_add(cpp_quad_fp_backend<FloatingPointType>& result, const cpp_quad_fp_backend<FloatingPointType>& x);
void eval_add(cpp_quad_float<FloatingPointType>& result, const cpp_quad_float<FloatingPointType>& x);
template <typename FloatingPointType>
void eval_subtract(cpp_quad_fp_backend<FloatingPointType>& result, const cpp_quad_fp_backend<FloatingPointType>& x);
void eval_subtract(cpp_quad_float<FloatingPointType>& result, const cpp_quad_float<FloatingPointType>& x);
template <typename FloatingPointType>
void eval_multiply(cpp_quad_fp_backend<FloatingPointType>& result, const cpp_quad_fp_backend<FloatingPointType>& x);
void eval_multiply(cpp_quad_float<FloatingPointType>& result, const cpp_quad_float<FloatingPointType>& x);
template <typename FloatingPointType>
void eval_divide(cpp_quad_fp_backend<FloatingPointType>& result, const cpp_quad_fp_backend<FloatingPointType>& x);
void eval_divide(cpp_quad_float<FloatingPointType>& result, const cpp_quad_float<FloatingPointType>& x);
template <typename FloatingPointType>
void eval_fabs(cpp_quad_fp_backend<FloatingPointType>& result, const cpp_quad_fp_backend<FloatingPointType>& a);
void eval_fabs(cpp_quad_float<FloatingPointType>& result, const cpp_quad_float<FloatingPointType>& a);
template <typename FloatingPointType>
void eval_frexp(cpp_quad_fp_backend<FloatingPointType>& result, const cpp_quad_fp_backend<FloatingPointType>& a, int* v);
void eval_frexp(cpp_quad_float<FloatingPointType>& result, const cpp_quad_float<FloatingPointType>& a, int* v);
template <typename FloatingPointType>
void eval_ldexp(cpp_quad_fp_backend<FloatingPointType>& result, const cpp_quad_fp_backend<FloatingPointType>& a, int v);
void eval_ldexp(cpp_quad_float<FloatingPointType>& result, const cpp_quad_float<FloatingPointType>& a, int v);
template <typename FloatingPointType>
void eval_floor(cpp_quad_fp_backend<FloatingPointType>& result, const cpp_quad_fp_backend<FloatingPointType>& x);
void eval_floor(cpp_quad_float<FloatingPointType>& result, const cpp_quad_float<FloatingPointType>& x);
template <typename FloatingPointType>
void eval_ceil(cpp_quad_fp_backend<FloatingPointType>& result, const cpp_quad_fp_backend<FloatingPointType>& x);
void eval_ceil(cpp_quad_float<FloatingPointType>& result, const cpp_quad_float<FloatingPointType>& x);
template <typename FloatingPointType>
void eval_sqrt(cpp_quad_fp_backend<FloatingPointType>& result, const cpp_quad_fp_backend<FloatingPointType>& o);
void eval_sqrt(cpp_quad_float<FloatingPointType>& result, const cpp_quad_float<FloatingPointType>& o);
template <typename FloatingPointType>
void eval_exp(cpp_quad_fp_backend<FloatingPointType>& result, const cpp_quad_fp_backend<FloatingPointType>& o);
void eval_exp(cpp_quad_float<FloatingPointType>& result, const cpp_quad_float<FloatingPointType>& o);
template <typename FloatingPointType>
int eval_fpclassify(const cpp_quad_fp_backend<FloatingPointType>& o);
int eval_fpclassify(const cpp_quad_float<FloatingPointType>& o);
template <typename FloatingPointType,
typename R>
typename std::enable_if<std::is_integral<R>::value == true>::type eval_convert_to(R* result, const cpp_quad_fp_backend<FloatingPointType>& backend);
typename std::enable_if<std::is_integral<R>::value == true>::type eval_convert_to(R* result, const cpp_quad_float<FloatingPointType>& backend);
template <typename FloatingPointType,
typename R>
typename std::enable_if<std::is_integral<R>::value == false>::type eval_convert_to(R* result, const cpp_quad_fp_backend<FloatingPointType>& backend);
typename std::enable_if<std::is_integral<R>::value == false>::type eval_convert_to(R* result, const cpp_quad_float<FloatingPointType>& backend);
template <typename FloatingPointType,
typename char_type,
typename traits_type>
std::basic_ostream<char_type, traits_type>& operator<<(std::basic_ostream<char_type, traits_type>& os,
const cpp_quad_fp_backend<FloatingPointType>& f);
const cpp_quad_float<FloatingPointType>& f);
template <typename FloatingPointType>
std::size_t hash_value(const cpp_quad_fp_backend<FloatingPointType>& a);
std::size_t hash_value(const cpp_quad_float<FloatingPointType>& a);
}}} // namespace boost::multiprecision::backends
namespace boost { namespace math {
template <typename FloatingPointType>
int (fpclassify)(const boost::multiprecision::backends::cpp_quad_fp_backend<FloatingPointType>& o);
int (fpclassify)(const boost::multiprecision::backends::cpp_quad_float<FloatingPointType>& o);
}} // namespace boost::math
@@ -122,29 +122,29 @@ namespace std {
// Foward declarations of various specializations of std::numeric_limits
template <typename FloatingPointType>
class numeric_limits<boost::multiprecision::backends::cpp_quad_fp_backend<FloatingPointType> >;
class numeric_limits<boost::multiprecision::backends::cpp_quad_float<FloatingPointType> >;
template <typename FloatingPointType,
const boost::multiprecision::expression_template_option ExpressionTemplatesOption>
class numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_fp_backend<FloatingPointType>, ExpressionTemplatesOption> >;
class numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_float<FloatingPointType>, ExpressionTemplatesOption> >;
} // namespace std
namespace boost { namespace multiprecision {
template <typename FloatingPointType>
struct number_category<backends::cpp_quad_fp_backend<FloatingPointType> >
struct number_category<backends::cpp_quad_float<FloatingPointType> >
: public std::integral_constant<int, number_kind_floating_point>
{};
namespace backends {
// A cpp_quad_fp_backend is represented by an unevaluated sum of four floating-point
// A cpp_quad_float is represented by an unevaluated sum of four floating-point
// units (say a[0...n]) which satisfy |a[i+1]| <= (1 / 2) * ulp(a[i]).
// The type of the floating-point constituents should adhere to IEEE754.
template <typename FloatingPointType>
class cpp_quad_fp_backend
class cpp_quad_float
{
public:
using float_type = FloatingPointType;
@@ -169,21 +169,21 @@ class cpp_quad_fp_backend
"Error: floating-point constituent does not have wide enough exponent range");
// Default constructor.
cpp_quad_fp_backend() {}
cpp_quad_float() {}
// Copy constructor.
constexpr cpp_quad_fp_backend(const cpp_quad_fp_backend&) = default;
constexpr cpp_quad_float(const cpp_quad_float&) = default;
// Constructors from other floating-point types.
template <typename OtherFloatType,
typename std::enable_if<(detail::is_floating_point_or_float128<OtherFloatType>::value == true) && (std::numeric_limits<OtherFloatType>::digits <= std::numeric_limits<float_type>::digits)>::type const* = nullptr>
constexpr cpp_quad_fp_backend(const OtherFloatType& f) : data(std::make_tuple(f, (float_type)0, (float_type)0, (float_type)0)) {}
constexpr cpp_quad_float(const OtherFloatType& f) : data(std::make_tuple(f, (float_type)0, (float_type)0, (float_type)0)) {}
constexpr cpp_quad_fp_backend(const rep_type& r) : data(r) {}
constexpr cpp_quad_float(const rep_type& r) : data(r) {}
template <typename OtherFloatType,
typename std::enable_if<((std::numeric_limits<OtherFloatType>::is_iec559 == true) && (std::numeric_limits<OtherFloatType>::digits > std::numeric_limits<float_type>::digits))>::type const* = nullptr>
cpp_quad_fp_backend(const OtherFloatType& f)
cpp_quad_float(const OtherFloatType& f)
{
using std::get;
get<0>(data) = static_cast<float_type>(f);
@@ -192,14 +192,14 @@ class cpp_quad_fp_backend
get<3>(data) = static_cast<float_type>(f - (OtherFloatType)get<2>(data) - (OtherFloatType)get<1>(data) - (OtherFloatType)get<0>(data));
}
// Constructor from other cpp_quad_fp_backend<> objects.
// Constructor from other cpp_quad_float<> objects.
template <typename OtherFloatType,
typename std::enable_if<((std::is_floating_point<OtherFloatType>::value == true) && (std::is_same<FloatingPointType, OtherFloatType>::value == false))>::type const* = nullptr>
cpp_quad_fp_backend(const cpp_quad_fp_backend<OtherFloatType>& a)
cpp_quad_float(const cpp_quad_float<OtherFloatType>& a)
{
using std::get;
using precise_type =
typename std::conditional<(std::numeric_limits<OtherFloatType>::digits > std::numeric_limits<float_type>::digits), cpp_quad_fp_backend, float_type>::type;
typename std::conditional<(std::numeric_limits<OtherFloatType>::digits > std::numeric_limits<float_type>::digits), cpp_quad_float, float_type>::type;
*this += (precise_type)get<0>(a.rep());
*this += (precise_type)get<1>(a.rep());
@@ -212,12 +212,12 @@ class cpp_quad_fp_backend
// Constructors from integers which can be easily fit into underlying floating-point type
template <typename IntegralType,
typename std::enable_if<((std::is_integral<IntegralType>::value == true) && (std::numeric_limits<IntegralType>::digits <= std::numeric_limits<FloatingPointType>::digits))>::type const* = nullptr>
constexpr cpp_quad_fp_backend(const IntegralType& f) : data(std::make_tuple(static_cast<float_type>(f), (float_type)0, (float_type)0, (float_type)0)) {}
constexpr cpp_quad_float(const IntegralType& f) : data(std::make_tuple(static_cast<float_type>(f), (float_type)0, (float_type)0, (float_type)0)) {}
// Constructors from integers which hold more information than *this can contain
template <typename UnsignedIntegralType,
typename std::enable_if<((std::is_integral<UnsignedIntegralType>::value == true) && (std::is_unsigned<UnsignedIntegralType>::value == true) && (std::numeric_limits<UnsignedIntegralType>::digits > std::numeric_limits<float_type>::digits))>::type const* = nullptr>
cpp_quad_fp_backend(UnsignedIntegralType u)
cpp_quad_float(UnsignedIntegralType u)
{
constexpr int MantissaBits = std::numeric_limits<FloatingPointType>::digits - 1;
@@ -243,25 +243,25 @@ class cpp_quad_fp_backend
template <typename SignedIntegralType,
typename std::enable_if<((std::is_integral<SignedIntegralType>::value == true) && (std::is_signed<SignedIntegralType>::value == true) && (std::numeric_limits<SignedIntegralType>::digits + 1 > std::numeric_limits<float_type>::digits))>::type const* = nullptr>
cpp_quad_fp_backend(SignedIntegralType n) : cpp_quad_fp_backend(static_cast<typename std::make_unsigned<SignedIntegralType>::type>(std::abs(n)))
cpp_quad_float(SignedIntegralType n) : cpp_quad_float(static_cast<typename std::make_unsigned<SignedIntegralType>::type>(std::abs(n)))
{
if (n < 0)
*this = -*this;
}
cpp_quad_fp_backend(const std::string& str)
cpp_quad_float(const std::string& str)
{
boost::multiprecision::detail::convert_from_string(*this, str.c_str());
}
cpp_quad_fp_backend(const char* pstr)
cpp_quad_float(const char* pstr)
{
boost::multiprecision::detail::convert_from_string(*this, pstr);
}
constexpr cpp_quad_fp_backend(cpp_quad_fp_backend&&) = default;
constexpr cpp_quad_float(cpp_quad_float&&) = default;
~cpp_quad_fp_backend() = default;
~cpp_quad_float() = default;
std::size_t hash() const
{
@@ -280,17 +280,17 @@ class cpp_quad_fp_backend
}
// Methods
constexpr cpp_quad_fp_backend negative() const
constexpr cpp_quad_float negative() const
{
using std::get;
return cpp_quad_fp_backend(std::make_tuple(-get<0>(data), -get<1>(data), -get<2>(data), -get<3>(data)));
return cpp_quad_float(std::make_tuple(-get<0>(data), -get<1>(data), -get<2>(data), -get<3>(data)));
}
constexpr bool is_neg() const { return get<0>(data) < 0; }
constexpr bool is_negative() const { return is_neg(); }
bool is_zero() const { return (compare(cpp_quad_fp_backend(0U)) == 0); }
bool is_one() const { return (compare(cpp_quad_fp_backend(1U)) == 0); }
bool is_zero() const { return (compare(cpp_quad_float(0U)) == 0); }
bool is_one() const { return (compare(cpp_quad_float(1U)) == 0); }
void negate()
{
@@ -302,18 +302,18 @@ class cpp_quad_fp_backend
const rep_type& crep() const { return data; }
// Assignment operators.
cpp_quad_fp_backend& operator=(const cpp_quad_fp_backend&) = default;
cpp_quad_float& operator=(const cpp_quad_float&) = default;
cpp_quad_fp_backend& operator=(cpp_quad_fp_backend&&) = default;
cpp_quad_float& operator=(cpp_quad_float&&) = default;
// Non-member add/sub/mul/div with constituent type.
friend inline cpp_quad_fp_backend operator+(const cpp_quad_fp_backend& a, const float_type& b) { return cpp_quad_fp_backend(a) += b; }
friend inline cpp_quad_fp_backend operator-(const cpp_quad_fp_backend& a, const float_type& b) { return cpp_quad_fp_backend(a) -= b; }
friend inline cpp_quad_fp_backend operator*(const cpp_quad_fp_backend& a, const float_type& b) { return cpp_quad_fp_backend(a) *= b; }
friend inline cpp_quad_fp_backend operator/(const cpp_quad_fp_backend& a, const float_type& b) { return cpp_quad_fp_backend(a) /= b; }
friend inline cpp_quad_float operator+(const cpp_quad_float& a, const float_type& b) { return cpp_quad_float(a) += b; }
friend inline cpp_quad_float operator-(const cpp_quad_float& a, const float_type& b) { return cpp_quad_float(a) -= b; }
friend inline cpp_quad_float operator*(const cpp_quad_float& a, const float_type& b) { return cpp_quad_float(a) *= b; }
friend inline cpp_quad_float operator/(const cpp_quad_float& a, const float_type& b) { return cpp_quad_float(a) /= b; }
// Unary add/sub/mul/div.
cpp_quad_fp_backend& operator+=(const float_type& other)
cpp_quad_float& operator+=(const float_type& other)
{
using std::tie;
using std::get;
@@ -332,7 +332,7 @@ class cpp_quad_fp_backend
return *this;
}
cpp_quad_fp_backend& operator+=(const cpp_quad_fp_backend& other)
cpp_quad_float& operator+=(const cpp_quad_float& other)
{
using std::array;
using std::fabs;
@@ -424,19 +424,19 @@ class cpp_quad_fp_backend
return *this;
}
cpp_quad_fp_backend& operator-=(const cpp_quad_fp_backend& other)
cpp_quad_float& operator-=(const cpp_quad_float& other)
{
*this += -other;
return *this;
}
cpp_quad_fp_backend& operator-=(const float_type& other)
cpp_quad_float& operator-=(const float_type& other)
{
*this += -other;
return *this;
}
cpp_quad_fp_backend& operator*=(const cpp_quad_fp_backend& other)
cpp_quad_float& operator*=(const cpp_quad_float& other)
{
using std::get;
using std::isfinite;
@@ -517,7 +517,7 @@ class cpp_quad_fp_backend
return *this;
}
cpp_quad_fp_backend& operator*=(const float_type& other)
cpp_quad_float& operator*=(const float_type& other)
{
using std::tie;
using std::get;
@@ -549,7 +549,7 @@ class cpp_quad_fp_backend
return *this;
}
cpp_quad_fp_backend& operator/=(const cpp_quad_fp_backend& other)
cpp_quad_float& operator/=(const cpp_quad_float& other)
{
using std::get;
using std::isfinite;
@@ -559,7 +559,7 @@ class cpp_quad_fp_backend
#endif
rep_type q;
cpp_quad_fp_backend r;
cpp_quad_float r;
get<0>(q) = get<0>(this->data) / get<0>(other.data);
@@ -586,35 +586,35 @@ class cpp_quad_fp_backend
}
// Unary add/sub/mul/div with constituent part.
cpp_quad_fp_backend& operator/=(const float_type& a)
cpp_quad_float& operator/=(const float_type& a)
{
*this /= cpp_quad_fp_backend(a);
*this /= cpp_quad_float(a);
return *this;
}
cpp_quad_fp_backend operator++(int)
cpp_quad_float operator++(int)
{
cpp_quad_fp_backend t(*this);
cpp_quad_float t(*this);
++*this;
return t;
}
cpp_quad_fp_backend operator--(int)
cpp_quad_float operator--(int)
{
cpp_quad_fp_backend t(*this);
cpp_quad_float t(*this);
--*this;
return t;
}
cpp_quad_fp_backend& operator++() { return *this += cpp_quad_fp_backend<float_type>(float_type(1.0F)); }
cpp_quad_fp_backend& operator--() { return *this -= cpp_quad_fp_backend<float_type>(float_type(1.0F)); }
cpp_quad_float& operator++() { return *this += cpp_quad_float<float_type>(float_type(1.0F)); }
cpp_quad_float& operator--() { return *this -= cpp_quad_float<float_type>(float_type(1.0F)); }
cpp_quad_fp_backend operator-() const { return negative(); }
cpp_quad_float operator-() const { return negative(); }
// Helper functions
static cpp_quad_fp_backend<float_type> pow10(int p)
static cpp_quad_float<float_type> pow10(int p)
{
using local_float_type = cpp_quad_fp_backend;
using local_float_type = cpp_quad_float;
local_float_type result;
@@ -661,7 +661,7 @@ class cpp_quad_fp_backend
return result;
}
void swap(cpp_quad_fp_backend& other)
void swap(cpp_quad_float& other)
{
rep_type tmp = data;
data = other.data;
@@ -669,7 +669,7 @@ class cpp_quad_fp_backend
}
// Return 1 for *this > other, -1 for *this < other, 0 for *this = other.
int compare(const cpp_quad_fp_backend& other) const
int compare(const cpp_quad_float& other) const
{
using std::get;
int n_result;
@@ -728,7 +728,7 @@ class cpp_quad_fp_backend
return e2;
}
static cpp_quad_fp_backend my_value_max() noexcept
static cpp_quad_float my_value_max() noexcept
{
using std::ldexp;
using std::sqrt;
@@ -736,7 +736,7 @@ class cpp_quad_fp_backend
using boost::multiprecision::ldexp;
using boost::multiprecision::sqrt;
#endif
return cpp_quad_fp_backend
return cpp_quad_float
(
arithmetic::four_sum
(
@@ -748,17 +748,17 @@ class cpp_quad_fp_backend
);
}
static cpp_quad_fp_backend my_value_min() noexcept
static cpp_quad_float my_value_min() noexcept
{
using std::ldexp;
#if defined(BOOST_MATH_USE_FLOAT128)
using boost::multiprecision::ldexp;
#endif
return cpp_quad_fp_backend(ldexp(float_type(1), std::numeric_limits<float_type>::min_exponent));
return cpp_quad_float(ldexp(float_type(1), std::numeric_limits<float_type>::min_exponent));
}
static cpp_quad_fp_backend my_value_eps() noexcept
static cpp_quad_float my_value_eps() noexcept
{
using std::ldexp;
#if defined(BOOST_MATH_USE_FLOAT128)
@@ -766,18 +766,18 @@ class cpp_quad_fp_backend
#endif
// TBD: Need a better value here.
return []() -> cpp_quad_fp_backend {
cpp_quad_fp_backend result;
return []() -> cpp_quad_float {
cpp_quad_float result;
eval_ldexp(result, cpp_quad_fp_backend(1), 6 - my_digits);
eval_ldexp(result, cpp_quad_float(1), 6 - my_digits);
return result;
}();
}
static constexpr cpp_quad_fp_backend my_value_nan() noexcept
static constexpr cpp_quad_float my_value_nan() noexcept
{
return cpp_quad_fp_backend(std::numeric_limits<float_type>::quiet_NaN());
return cpp_quad_float(std::numeric_limits<float_type>::quiet_NaN());
}
private:
@@ -785,31 +785,31 @@ class cpp_quad_fp_backend
};
template <typename FloatingPointType>
inline cpp_quad_fp_backend<FloatingPointType> operator+(const cpp_quad_fp_backend<FloatingPointType>& a, const cpp_quad_fp_backend<FloatingPointType>& b) { return cpp_quad_fp_backend<FloatingPointType>(a) += b; }
inline cpp_quad_float<FloatingPointType> operator+(const cpp_quad_float<FloatingPointType>& a, const cpp_quad_float<FloatingPointType>& b) { return cpp_quad_float<FloatingPointType>(a) += b; }
template <typename FloatingPointType>
inline cpp_quad_fp_backend<FloatingPointType> operator-(const cpp_quad_fp_backend<FloatingPointType>& a, const cpp_quad_fp_backend<FloatingPointType>& b) { return cpp_quad_fp_backend<FloatingPointType>(a) -= b; }
inline cpp_quad_float<FloatingPointType> operator-(const cpp_quad_float<FloatingPointType>& a, const cpp_quad_float<FloatingPointType>& b) { return cpp_quad_float<FloatingPointType>(a) -= b; }
template <typename FloatingPointType>
inline cpp_quad_fp_backend<FloatingPointType> operator*(const cpp_quad_fp_backend<FloatingPointType>& a, const cpp_quad_fp_backend<FloatingPointType>& b) { return cpp_quad_fp_backend<FloatingPointType>(a) *= b; }
inline cpp_quad_float<FloatingPointType> operator*(const cpp_quad_float<FloatingPointType>& a, const cpp_quad_float<FloatingPointType>& b) { return cpp_quad_float<FloatingPointType>(a) *= b; }
template <typename FloatingPointType>
inline cpp_quad_fp_backend<FloatingPointType> operator/(const cpp_quad_fp_backend<FloatingPointType>& a, const cpp_quad_fp_backend<FloatingPointType>& b) { return cpp_quad_fp_backend<FloatingPointType>(a) /= b; }
inline cpp_quad_float<FloatingPointType> operator/(const cpp_quad_float<FloatingPointType>& a, const cpp_quad_float<FloatingPointType>& b) { return cpp_quad_float<FloatingPointType>(a) /= b; }
template <typename FloatingPointType>
inline bool operator<(const cpp_quad_fp_backend<FloatingPointType>& a, const cpp_quad_fp_backend<FloatingPointType>& b) { return (a.compare(b) < 0); }
inline bool operator<(const cpp_quad_float<FloatingPointType>& a, const cpp_quad_float<FloatingPointType>& b) { return (a.compare(b) < 0); }
template <typename FloatingPointType>
inline bool operator<=(const cpp_quad_fp_backend<FloatingPointType>& a, const cpp_quad_fp_backend<FloatingPointType>& b) { return (a.compare(b) <= 0); }
inline bool operator<=(const cpp_quad_float<FloatingPointType>& a, const cpp_quad_float<FloatingPointType>& b) { return (a.compare(b) <= 0); }
template <typename FloatingPointType>
inline bool operator==(const cpp_quad_fp_backend<FloatingPointType>& a, const cpp_quad_fp_backend<FloatingPointType>& b) { return (a.compare(b) == 0); }
inline bool operator==(const cpp_quad_float<FloatingPointType>& a, const cpp_quad_float<FloatingPointType>& b) { return (a.compare(b) == 0); }
template <typename FloatingPointType>
inline bool operator!=(const cpp_quad_fp_backend<FloatingPointType>& a, const cpp_quad_fp_backend<FloatingPointType>& b) { return (a.compare(b) != 0); }
inline bool operator!=(const cpp_quad_float<FloatingPointType>& a, const cpp_quad_float<FloatingPointType>& b) { return (a.compare(b) != 0); }
template <typename FloatingPointType>
inline bool operator>=(const cpp_quad_fp_backend<FloatingPointType>& a, const cpp_quad_fp_backend<FloatingPointType>& b) { return (a.compare(b) >= 0); }
inline bool operator>=(const cpp_quad_float<FloatingPointType>& a, const cpp_quad_float<FloatingPointType>& b) { return (a.compare(b) >= 0); }
template <typename FloatingPointType>
inline bool operator>(const cpp_quad_fp_backend<FloatingPointType>& a, const cpp_quad_fp_backend<FloatingPointType>& b) { return (a.compare(b) > 0); }
inline bool operator>(const cpp_quad_float<FloatingPointType>& a, const cpp_quad_float<FloatingPointType>& b) { return (a.compare(b) > 0); }
// -- Input/Output Streaming
template <typename FloatingPointType, typename char_type, typename traits_type>
std::basic_ostream<char_type, traits_type>&
operator<<(std::basic_ostream<char_type, traits_type>& os, const cpp_quad_fp_backend<FloatingPointType>& f)
operator<<(std::basic_ostream<char_type, traits_type>& os, const cpp_quad_float<FloatingPointType>& f)
{
const std::string str_result = f.str(os.precision(), os.flags());
@@ -818,41 +818,40 @@ operator<<(std::basic_ostream<char_type, traits_type>& os, const cpp_quad_fp_bac
template <typename FloatingPointType, typename char_type, typename traits_type>
std::basic_istream<char_type, traits_type>&
operator>>(std::basic_istream<char_type, traits_type>& is, cpp_quad_fp_backend<FloatingPointType>& f)
operator>>(std::basic_istream<char_type, traits_type>& is, cpp_quad_float<FloatingPointType>& f)
{
std::string str;
is >> str;
f = cpp_quad_fp_backend<FloatingPointType>(str);
f = cpp_quad_float<FloatingPointType>(str);
return is;
}
// TBD: We can potentially try to resolve the enable_if's a bit better in these eval_* ops.
template <typename FloatingPointType>
void eval_add(cpp_quad_fp_backend<FloatingPointType>& result, const cpp_quad_fp_backend<FloatingPointType>& x) { result += x; }
void eval_add(cpp_quad_float<FloatingPointType>& result, const cpp_quad_float<FloatingPointType>& x) { result += x; }
template <typename FloatingPointType>
void eval_add(cpp_quad_fp_backend<FloatingPointType>& result, const FloatingPointType& x) { result += x; }
void eval_add(cpp_quad_float<FloatingPointType>& result, const FloatingPointType& x) { result += x; }
template <typename FloatingPointType, typename NumericType, typename std::enable_if<(std::numeric_limits<NumericType>::digits <= std::numeric_limits<FloatingPointType>::digits)>::type const* = nullptr>
void eval_add(cpp_quad_fp_backend<FloatingPointType>& result, const NumericType& x) { eval_add(result, static_cast<FloatingPointType>(x)); }
void eval_add(cpp_quad_float<FloatingPointType>& result, const NumericType& x) { eval_add(result, static_cast<FloatingPointType>(x)); }
template <typename FloatingPointType>
void eval_subtract(cpp_quad_fp_backend<FloatingPointType>& result, const cpp_quad_fp_backend<FloatingPointType>& x) { result -= x; }
void eval_subtract(cpp_quad_float<FloatingPointType>& result, const cpp_quad_float<FloatingPointType>& x) { result -= x; }
template <typename FloatingPointType>
void eval_subtract(cpp_quad_fp_backend<FloatingPointType>& result, const FloatingPointType& x) { result -= x; }
void eval_subtract(cpp_quad_float<FloatingPointType>& result, const FloatingPointType& x) { result -= x; }
template <typename FloatingPointType, typename NumericType, typename std::enable_if<std::numeric_limits<NumericType>::digits <= std::numeric_limits<FloatingPointType>::digits>::type const* = nullptr>
void eval_subtract(cpp_quad_fp_backend<FloatingPointType>& result, const NumericType& x) { eval_subtract(result, static_cast<FloatingPointType>(x)); }
void eval_subtract(cpp_quad_float<FloatingPointType>& result, const NumericType& x) { eval_subtract(result, static_cast<FloatingPointType>(x)); }
template <typename FloatingPointType>
void eval_multiply(cpp_quad_fp_backend<FloatingPointType>& result, const cpp_quad_fp_backend<FloatingPointType>& x) { result *= x; }
void eval_multiply(cpp_quad_float<FloatingPointType>& result, const cpp_quad_float<FloatingPointType>& x) { result *= x; }
template <typename FloatingPointType>
void eval_multiply(cpp_quad_fp_backend<FloatingPointType>& result, const FloatingPointType& x) { result *= x; }
void eval_multiply(cpp_quad_float<FloatingPointType>& result, const FloatingPointType& x) { result *= x; }
template <typename FloatingPointType, typename NumericType, typename std::enable_if<std::numeric_limits<NumericType>::digits <= std::numeric_limits<FloatingPointType>::digits>::type const* = nullptr>
void eval_multiply(cpp_quad_fp_backend<FloatingPointType>& result, const NumericType& x) { eval_multiply(result, static_cast<FloatingPointType>(x)); }
void eval_multiply(cpp_quad_float<FloatingPointType>& result, const NumericType& x) { eval_multiply(result, static_cast<FloatingPointType>(x)); }
template <typename FloatingPointType>
void eval_divide (cpp_quad_fp_backend<FloatingPointType>& result, const cpp_quad_fp_backend<FloatingPointType>& x) { result /= x; }
void eval_divide (cpp_quad_float<FloatingPointType>& result, const cpp_quad_float<FloatingPointType>& x) { result /= x; }
template <typename FloatingPointType>
void eval_fabs(cpp_quad_fp_backend<FloatingPointType>& result, const cpp_quad_fp_backend<FloatingPointType>& a)
void eval_fabs(cpp_quad_float<FloatingPointType>& result, const cpp_quad_float<FloatingPointType>& a)
{
result = a;
@@ -863,7 +862,7 @@ void eval_fabs(cpp_quad_fp_backend<FloatingPointType>& result, const cpp_quad_fp
}
template <typename FloatingPointType>
void eval_frexp(cpp_quad_fp_backend<FloatingPointType>& result, const cpp_quad_fp_backend<FloatingPointType>& a, int* v)
void eval_frexp(cpp_quad_float<FloatingPointType>& result, const cpp_quad_float<FloatingPointType>& a, int* v)
{
using std::frexp;
using std::ldexp;
@@ -875,11 +874,11 @@ void eval_frexp(cpp_quad_fp_backend<FloatingPointType>& result, const cpp_quad_f
}
template <typename FloatingPointType>
void eval_ldexp(cpp_quad_fp_backend<FloatingPointType>& result, const cpp_quad_fp_backend<FloatingPointType>& a, int v)
void eval_ldexp(cpp_quad_float<FloatingPointType>& result, const cpp_quad_float<FloatingPointType>& a, int v)
{
using std::ldexp;
using quad_float_type = cpp_quad_fp_backend<FloatingPointType>;
using quad_float_type = cpp_quad_float<FloatingPointType>;
typename quad_float_type::rep_type z =
std::make_tuple
@@ -896,12 +895,12 @@ void eval_ldexp(cpp_quad_fp_backend<FloatingPointType>& result, const cpp_quad_f
}
template <typename FloatingPointType>
void eval_floor(cpp_quad_fp_backend<FloatingPointType>& result, const cpp_quad_fp_backend<FloatingPointType>& x)
void eval_floor(cpp_quad_float<FloatingPointType>& result, const cpp_quad_float<FloatingPointType>& x)
{
using local_float_type = typename cpp_quad_fp_backend<FloatingPointType>::float_type;
using local_float_type = typename cpp_quad_float<FloatingPointType>::float_type;
using double_float_type = cpp_double_fp_backend<local_float_type>;
using quad_float_type = cpp_quad_fp_backend <local_float_type>;
using double_float_type = cpp_double_float<local_float_type>;
using quad_float_type = cpp_quad_float <local_float_type>;
double_float_type fhi;
@@ -933,7 +932,7 @@ void eval_floor(cpp_quad_fp_backend<FloatingPointType>& result, const cpp_quad_f
}
template <typename FloatingPointType>
void eval_ceil(cpp_quad_fp_backend<FloatingPointType>& result, const cpp_quad_fp_backend<FloatingPointType>& x)
void eval_ceil(cpp_quad_float<FloatingPointType>& result, const cpp_quad_float<FloatingPointType>& x)
{
// Compute -floor(-x);
eval_floor(result, -x);
@@ -942,9 +941,9 @@ void eval_ceil(cpp_quad_fp_backend<FloatingPointType>& result, const cpp_quad_fp
}
template <typename FloatingPointType>
void eval_sqrt(cpp_quad_fp_backend<FloatingPointType>& result, const cpp_quad_fp_backend<FloatingPointType>& x)
void eval_sqrt(cpp_quad_float<FloatingPointType>& result, const cpp_quad_float<FloatingPointType>& x)
{
using quad_float_type = cpp_quad_fp_backend <FloatingPointType>;
using quad_float_type = cpp_quad_float <FloatingPointType>;
using std::sqrt;
#if defined(BOOST_MATH_USE_FLOAT128)
@@ -957,7 +956,7 @@ void eval_sqrt(cpp_quad_fp_backend<FloatingPointType>& result, const cpp_quad_fp
}
else if(std::get<0>(x.crep()) < typename quad_float_type::float_type(0.0F))
{
result = cpp_quad_fp_backend<FloatingPointType>::my_value_nan();
result = cpp_quad_float<FloatingPointType>::my_value_nan();
}
else
{
@@ -974,7 +973,7 @@ void eval_sqrt(cpp_quad_fp_backend<FloatingPointType>& result, const cpp_quad_fp
}
template <typename FloatingPointType>
void eval_exp(cpp_quad_fp_backend<FloatingPointType>& result, const cpp_quad_fp_backend<FloatingPointType>& x)
void eval_exp(cpp_quad_float<FloatingPointType>& result, const cpp_quad_float<FloatingPointType>& x)
{
const bool x_is_zero = x.is_zero();
@@ -984,7 +983,7 @@ void eval_exp(cpp_quad_fp_backend<FloatingPointType>& result, const cpp_quad_fp_
}
else
{
using quad_float_type = cpp_quad_fp_backend<FloatingPointType>;
using quad_float_type = cpp_quad_float<FloatingPointType>;
using local_float_type = typename quad_float_type::float_type;
// Get a local copy of the argument and force it to be positive.
@@ -1095,14 +1094,14 @@ void eval_exp(cpp_quad_fp_backend<FloatingPointType>& result, const cpp_quad_fp_
}
template <typename FloatingPointType>
int eval_fpclassify(const cpp_quad_fp_backend<FloatingPointType>& o)
int eval_fpclassify(const cpp_quad_float<FloatingPointType>& o)
{
return (int)(boost::math::fpclassify)(std::get<0>(o.crep()));
}
template <typename FloatingPointType,
typename R>
typename std::enable_if<std::is_integral<R>::value == true>::type eval_convert_to(R* result, const cpp_quad_fp_backend<FloatingPointType>& backend)
typename std::enable_if<std::is_integral<R>::value == true>::type eval_convert_to(R* result, const cpp_quad_float<FloatingPointType>& backend)
{
// TBD: Does boost::common_type have a C++ 11 replacement?
using c_type = typename boost::common_type<R, FloatingPointType>::type;
@@ -1117,7 +1116,7 @@ typename std::enable_if<std::is_integral<R>::value == true>::type eval_convert_t
if (ct > my_max)
if (!std::is_unsigned<R>::value)
*result = std::get<0>(backend.crep()) >= typename cpp_quad_fp_backend<FloatingPointType>::float_type(0U) ? (std::numeric_limits<R>::max)() : detail::minus_max<R>();
*result = std::get<0>(backend.crep()) >= typename cpp_quad_float<FloatingPointType>::float_type(0U) ? (std::numeric_limits<R>::max)() : detail::minus_max<R>();
else
*result = (std::numeric_limits<R>::max)();
else
@@ -1135,7 +1134,7 @@ typename std::enable_if<std::is_integral<R>::value == true>::type eval_convert_t
template <typename FloatingPointType,
typename R>
typename std::enable_if<std::is_integral<R>::value == false>::type eval_convert_to(R* result, const cpp_quad_fp_backend<FloatingPointType>& backend)
typename std::enable_if<std::is_integral<R>::value == false>::type eval_convert_to(R* result, const cpp_quad_float<FloatingPointType>& backend)
{
*result = (R) std::get<0>(backend.crep());
if (std::numeric_limits<decltype(*result)>::digits > std::numeric_limits<FloatingPointType>::digits)
@@ -1147,17 +1146,17 @@ typename std::enable_if<std::is_integral<R>::value == false>::type eval_convert_
}
template <typename FloatingPointType>
std::size_t hash_value(const cpp_quad_fp_backend<FloatingPointType>& a)
std::size_t hash_value(const cpp_quad_float<FloatingPointType>& a)
{
return a.hash();
}
} // namespace backends
using cpp_quad_double = number<backends::cpp_quad_fp_backend<double>>;
using cpp_quad_long_double = number<backends::cpp_quad_fp_backend<long double>>;
using cpp_quad_double = number<backends::cpp_quad_float<double>>;
using cpp_quad_long_double = number<backends::cpp_quad_float<long double>>;
#ifdef BOOST_MATH_USE_FLOAT128
using cpp_quad_float128 = number<backends::cpp_quad_fp_backend<float128>>;
using cpp_quad_float128 = number<backends::cpp_quad_float<float128>>;
#endif
}} // namespace boost::multiprecision
@@ -1165,7 +1164,7 @@ using cpp_quad_float128 = number<backends::cpp_quad_fp_backend<float128>>;
namespace boost { namespace math {
template <typename FloatingPointType>
int (fpclassify)(const boost::multiprecision::backends::cpp_quad_fp_backend<FloatingPointType>& o)
int (fpclassify)(const boost::multiprecision::backends::cpp_quad_float<FloatingPointType>& o)
{
using std::fpclassify;
@@ -1175,16 +1174,16 @@ int (fpclassify)(const boost::multiprecision::backends::cpp_quad_fp_backend<Floa
}} // namespace boost::math
namespace std {
// Specialization of numeric_limits for boost::multiprecision::number<cpp_quad_fp_backend<>>
// Specialization of numeric_limits for boost::multiprecision::number<cpp_quad_float<>>
template <typename FloatingPointType,
const boost::multiprecision::expression_template_option ExpressionTemplatesOption>
class numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_fp_backend<FloatingPointType>, ExpressionTemplatesOption>>
class numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_float<FloatingPointType>, ExpressionTemplatesOption>>
: public std::numeric_limits<FloatingPointType>
{
private:
using base_class_type = std::numeric_limits<FloatingPointType>;
using inner_self_type = boost::multiprecision::backends::cpp_quad_fp_backend<FloatingPointType>;
using inner_self_type = boost::multiprecision::backends::cpp_quad_float<FloatingPointType>;
using self_type =
boost::multiprecision::number<inner_self_type, ExpressionTemplatesOption>;
@@ -1222,34 +1221,34 @@ public:
}
template <typename FloatingPointType, const boost::multiprecision::expression_template_option ExpressionTemplatesOption>
constexpr bool std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_fp_backend<FloatingPointType>, ExpressionTemplatesOption> >::is_specialized;
constexpr bool std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_float<FloatingPointType>, ExpressionTemplatesOption> >::is_specialized;
template <typename FloatingPointType, const boost::multiprecision::expression_template_option ExpressionTemplatesOption>
constexpr bool std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_fp_backend<FloatingPointType>, ExpressionTemplatesOption> >::is_signed;
constexpr bool std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_float<FloatingPointType>, ExpressionTemplatesOption> >::is_signed;
template <typename FloatingPointType, const boost::multiprecision::expression_template_option ExpressionTemplatesOption>
constexpr bool std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_fp_backend<FloatingPointType>, ExpressionTemplatesOption> >::is_integer;
constexpr bool std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_float<FloatingPointType>, ExpressionTemplatesOption> >::is_integer;
template <typename FloatingPointType, const boost::multiprecision::expression_template_option ExpressionTemplatesOption>
constexpr bool std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_fp_backend<FloatingPointType>, ExpressionTemplatesOption> >::is_exact;
constexpr bool std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_float<FloatingPointType>, ExpressionTemplatesOption> >::is_exact;
template <typename FloatingPointType, const boost::multiprecision::expression_template_option ExpressionTemplatesOption>
constexpr bool std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_fp_backend<FloatingPointType>, ExpressionTemplatesOption> >::is_bounded;
constexpr bool std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_float<FloatingPointType>, ExpressionTemplatesOption> >::is_bounded;
template <typename FloatingPointType, const boost::multiprecision::expression_template_option ExpressionTemplatesOption>
constexpr bool std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_fp_backend<FloatingPointType>, ExpressionTemplatesOption> >::is_modulo;
constexpr bool std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_float<FloatingPointType>, ExpressionTemplatesOption> >::is_modulo;
template <typename FloatingPointType, const boost::multiprecision::expression_template_option ExpressionTemplatesOption>
constexpr bool std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_fp_backend<FloatingPointType>, ExpressionTemplatesOption> >::is_iec559;
constexpr bool std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_float<FloatingPointType>, ExpressionTemplatesOption> >::is_iec559;
template <typename FloatingPointType, const boost::multiprecision::expression_template_option ExpressionTemplatesOption>
constexpr std::float_denorm_style std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_fp_backend<FloatingPointType>, ExpressionTemplatesOption> >::has_denorm;
constexpr std::float_denorm_style std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_float<FloatingPointType>, ExpressionTemplatesOption> >::has_denorm;
template <typename FloatingPointType, const boost::multiprecision::expression_template_option ExpressionTemplatesOption>
constexpr int std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_fp_backend<FloatingPointType>, ExpressionTemplatesOption> >::digits;
constexpr int std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_float<FloatingPointType>, ExpressionTemplatesOption> >::digits;
template <typename FloatingPointType, const boost::multiprecision::expression_template_option ExpressionTemplatesOption>
constexpr int std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_fp_backend<FloatingPointType>, ExpressionTemplatesOption> >::digits10;
constexpr int std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_float<FloatingPointType>, ExpressionTemplatesOption> >::digits10;
template <typename FloatingPointType, const boost::multiprecision::expression_template_option ExpressionTemplatesOption>
constexpr int std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_fp_backend<FloatingPointType>, ExpressionTemplatesOption> >::max_digits10;
constexpr int std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_float<FloatingPointType>, ExpressionTemplatesOption> >::max_digits10;
template <typename FloatingPointType, const boost::multiprecision::expression_template_option ExpressionTemplatesOption>
constexpr int std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_fp_backend<FloatingPointType>, ExpressionTemplatesOption> >::max_exponent;
constexpr int std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_float<FloatingPointType>, ExpressionTemplatesOption> >::max_exponent;
template <typename FloatingPointType, const boost::multiprecision::expression_template_option ExpressionTemplatesOption>
constexpr int std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_fp_backend<FloatingPointType>, ExpressionTemplatesOption> >::min_exponent;
constexpr int std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_float<FloatingPointType>, ExpressionTemplatesOption> >::min_exponent;
template <typename FloatingPointType, const boost::multiprecision::expression_template_option ExpressionTemplatesOption>
constexpr int std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_fp_backend<FloatingPointType>, ExpressionTemplatesOption> >::max_exponent10;
constexpr int std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_float<FloatingPointType>, ExpressionTemplatesOption> >::max_exponent10;
template <typename FloatingPointType, const boost::multiprecision::expression_template_option ExpressionTemplatesOption>
constexpr int std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_fp_backend<FloatingPointType>, ExpressionTemplatesOption> >::min_exponent10;
constexpr int std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_float<FloatingPointType>, ExpressionTemplatesOption> >::min_exponent10;
#endif // BOOST_MP_CPP_QUAD_FLOAT_2021_07_29_HPP
+22 -22
View File
@@ -175,9 +175,9 @@ using local_float_constituent_type = double;
void test53()
{
using quad_float_of_double_type = boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_fp_backend<local_float_constituent_type>, boost::multiprecision::et_off>;
using quad_float_of_double_type = boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_float<local_float_constituent_type>, boost::multiprecision::et_off>;
test<quad_float_of_double_type>("cpp_quad_fp_backend", 1024*16);
test<quad_float_of_double_type>("cpp_quad_float", 1024*16);
}
#elif defined(TEST_CPP_BIN_FLOAT)
@@ -201,26 +201,26 @@ void test33()
#endif
// Chris PC TEST_CPP_QUAD_FLOAT
//cpp_quad_fp_backend 16384 + 0.0328359
//cpp_quad_fp_backend 16384 - 0.0326524
//cpp_quad_fp_backend 16384 * 0.0516673
//cpp_quad_fp_backend 16384 / 0.707075
//cpp_quad_fp_backend 16384 str 0.0419498
//cpp_quad_fp_backend 16384 +(int) 0.0267044
//cpp_quad_fp_backend 16384 -(int) 0.0279037
//cpp_quad_fp_backend 16384 *(int) 0.0512275
//cpp_quad_fp_backend 16384 /(int) 0.327655
//cpp_quad_fp_backend 16384 construct 0.0011852
//cpp_quad_fp_backend 16384 construct(unsigned) 0.0011655
//cpp_quad_fp_backend 16384 construct(unsigned long long) 0.171181
//cpp_quad_fp_backend 16384 +(unsigned long long) 0.113957
//cpp_quad_fp_backend 16384 -(unsigned long long) 0.115939
//cpp_quad_fp_backend 16384 *(unsigned long long) 0.142094
//cpp_quad_fp_backend 16384 /(unsigned long long) 0.407529
//cpp_quad_fp_backend 16384 +=(unsigned long long) 0.113941
//cpp_quad_fp_backend 16384 -=(unsigned long long) 0.114742
//cpp_quad_fp_backend 16384 *=(unsigned long long) 0.141193
//cpp_quad_fp_backend 16384 /=(unsigned long long) 0.410069
//cpp_quad_float 16384 + 0.0328359
//cpp_quad_float 16384 - 0.0326524
//cpp_quad_float 16384 * 0.0516673
//cpp_quad_float 16384 / 0.707075
//cpp_quad_float 16384 str 0.0419498
//cpp_quad_float 16384 +(int) 0.0267044
//cpp_quad_float 16384 -(int) 0.0279037
//cpp_quad_float 16384 *(int) 0.0512275
//cpp_quad_float 16384 /(int) 0.327655
//cpp_quad_float 16384 construct 0.0011852
//cpp_quad_float 16384 construct(unsigned) 0.0011655
//cpp_quad_float 16384 construct(unsigned long long) 0.171181
//cpp_quad_float 16384 +(unsigned long long) 0.113957
//cpp_quad_float 16384 -(unsigned long long) 0.115939
//cpp_quad_float 16384 *(unsigned long long) 0.142094
//cpp_quad_float 16384 /(unsigned long long) 0.407529
//cpp_quad_float 16384 +=(unsigned long long) 0.113941
//cpp_quad_float 16384 -=(unsigned long long) 0.114742
//cpp_quad_float 16384 *=(unsigned long long) 0.141193
//cpp_quad_float 16384 /=(unsigned long long) 0.410069
// Chris PC TEST_CPP_BIN_FLOAT
+4 -2
View File
@@ -172,12 +172,14 @@ void foo()
test_extra(num_t());
#endif
#ifdef TEST_CPP_DOUBLE_FLOAT
using cpp_double_float_of_double_type = boost::multiprecision::cpp_double_double;
using cpp_double_float_of_double_type =
boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<double>, boost::multiprecision::et_off>;
test_extra(cpp_double_float_of_double_type());
#endif
#ifdef TEST_CPP_QUAD_FLOAT
using cpp_quad_float_of_double_type = boost::multiprecision::cpp_quad_double;
using cpp_quad_float_of_double_type =
boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_float<double>, boost::multiprecision::et_off>;
test_extra(cpp_quad_float_of_double_type());
#endif
+4 -2
View File
@@ -139,12 +139,14 @@ void foo()
test_extra(num_t());
#endif
#ifdef TEST_CPP_DOUBLE_FLOAT
using cpp_double_float_of_double_type = boost::multiprecision::cpp_double_double;
using cpp_double_float_of_double_type =
boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<double>, boost::multiprecision::et_off>;
test_extra(cpp_double_float_of_double_type());
#endif
#ifdef TEST_CPP_QUAD_FLOAT
using cpp_quad_float_of_double_type = boost::multiprecision::cpp_quad_double;
using cpp_quad_float_of_double_type =
boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_float<double>, boost::multiprecision::et_off>;
test_extra(cpp_quad_float_of_double_type());
#endif
+4 -3
View File
@@ -149,10 +149,11 @@ int main()
test<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<35, boost::multiprecision::digit_base_10, std::allocator<char>, boost::long_long_type> > >();
#endif
#ifdef TEST_CPP_DOUBLE_FLOAT
test<boost::multiprecision::cpp_double_float>();
test<boost::multiprecision::cpp_double_double>();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<float> > >();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<double> > >();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<long double> > >();
#if defined(BOOST_MATH_USE_FLOAT128)
test<boost::multiprecision::cpp_double_float128>();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<boost::multiprecision::float128> > >();
#endif
#endif
return boost::report_errors();
+4 -4
View File
@@ -23,11 +23,11 @@
int main()
{
using double_float_of_float_type = boost::multiprecision::cpp_double_float;
using double_float_of_double_type = boost::multiprecision::cpp_double_double;
using double_float_of_ldbl_type = boost::multiprecision::cpp_double_long_double;
using double_float_of_float_type = boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<float>, boost::multiprecision::et_off>;
using double_float_of_double_type = boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<double>, boost::multiprecision::et_off>;
using double_float_of_ldbl_type = boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<long double>, boost::multiprecision::et_off>;
#ifdef BOOST_MATH_USE_FLOAT128
using double_float_of_float128_type = boost::multiprecision::cpp_double_float128;
using double_float_of_float128_type = boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<boost::multiprecision::float128>, boost::multiprecision::et_off>;
#endif
test<double_float_of_float_type>();
+3 -3
View File
@@ -23,10 +23,10 @@
int main()
{
using quad_float_of_double_type = boost::multiprecision::cpp_quad_double;
using quad_float_of_ldbl_type = boost::multiprecision::cpp_quad_long_double;
using quad_float_of_double_type = boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_float<double>, boost::multiprecision::et_off>;
using quad_float_of_ldbl_type = boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_float<long double>, boost::multiprecision::et_off>;
#ifdef BOOST_MATH_USE_FLOAT128
using quad_float_of_float128_type = boost::multiprecision::cpp_quad_float128;
using quad_float_of_float128_type = boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_float<boost::multiprecision::float128>, boost::multiprecision::et_off>;
#endif
test<quad_float_of_double_type>();
+4 -4
View File
@@ -144,11 +144,11 @@ int main()
test<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<35, boost::multiprecision::digit_base_10, std::allocator<char>, boost::long_long_type> > >();
#endif
#ifdef TEST_CPP_DOUBLE_FLOAT
test<boost::multiprecision::cpp_double_float>();
test<boost::multiprecision::cpp_double_double>();
test<boost::multiprecision::cpp_double_long_double>();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<float> > >();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<double> > >();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<long double> > >();
#if defined(BOOST_MATH_USE_FLOAT128)
test<boost::multiprecision::cpp_double_float128>();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<boost::multiprecision::float128> > >();
#endif
#endif
return boost::report_errors();
+4 -4
View File
@@ -300,11 +300,11 @@ int main()
test<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<35, boost::multiprecision::digit_base_10, std::allocator<char>, boost::long_long_type> > >();
#endif
#ifdef TEST_CPP_DOUBLE_FLOAT
test<boost::multiprecision::cpp_double_float>();
test<boost::multiprecision::cpp_double_double>();
test<boost::multiprecision::cpp_double_long_double>();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<float> > >();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<double> > >();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<long double> > >();
#if defined(BOOST_MATH_USE_FLOAT128)
test<boost::multiprecision::cpp_double_float128>();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<boost::multiprecision::float128> > >();
#endif
#endif
return boost::report_errors();
+4 -3
View File
@@ -389,10 +389,11 @@ int main()
test<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<35, boost::multiprecision::digit_base_10, std::allocator<char>, boost::long_long_type> > >();
#endif
#ifdef TEST_CPP_DOUBLE_FLOAT
test<boost::multiprecision::cpp_double_float>();
test<boost::multiprecision::cpp_double_double>();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<float> > >();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<double> > >();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<long double> > >();
#if defined(BOOST_MATH_USE_FLOAT128)
test<boost::multiprecision::cpp_double_float128>();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<boost::multiprecision::float128> > >();
#endif
#endif
return boost::report_errors();
+3 -4
View File
@@ -189,11 +189,10 @@ int main()
test<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<35, boost::multiprecision::digit_base_10, std::allocator<char>, boost::long_long_type> > >();
#endif
#ifdef TEST_CPP_DOUBLE_FLOAT
test<boost::multiprecision::cpp_double_float>();
test<boost::multiprecision::cpp_double_double>();
test<boost::multiprecision::cpp_double_long_double>();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<float> > >();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<double> > >();
#if defined(BOOST_MATH_USE_FLOAT128)
test<boost::multiprecision::cpp_double_float128>();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<boost::multiprecision::float128> > >();
#endif
#endif
return boost::report_errors();
+2 -2
View File
@@ -6,7 +6,7 @@
// (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// Test for correctness of arithmetic operators of cpp_double_fp_backend<>
// Test for correctness of arithmetic operators of cpp_double_float<>
// cd /mnt/c/Users/User/Documents/Ks/PC_Software/Test
// g++ -O3 -Wall -march=native -std=c++11 -I/mnt/c/MyGitRepos/BoostGSoC21_multiprecision/include -I/mnt/c/boost/boost_1_76_0 test.cpp -o test_double_float.exe
@@ -54,7 +54,7 @@ namespace local
static unsigned seed_prescaler;
using double_float_type = boost::multiprecision::number<boost::multiprecision::backends::cpp_double_fp_backend<float_type>, boost::multiprecision::et_off>;
using double_float_type = boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<float_type>, boost::multiprecision::et_off>;
using control_float_type = boost::multiprecision::number<boost::multiprecision::cpp_dec_float<(2 * std::numeric_limits<double_float_type>::digits10) + 1>, boost::multiprecision::et_off>;
static_assert( digits == std::numeric_limits<double_float_type>::digits , "Error in digit parameters" );
+10 -10
View File
@@ -6,7 +6,7 @@
// (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// Test for correctness of arithmetic operators of cpp_double_fp_backend<>
// Test for correctness of arithmetic operators of cpp_double_float<>
// cd /mnt/c/Users/User/Documents/Ks/PC_Software/Test
// g++ -O3 -Wall -march=native -std=c++11 -I/mnt/c/MyGitRepos/BoostGSoC21_multiprecision/include -I/mnt/c/boost/boost_1_76_0 test.cpp -o test_double_float.exe
@@ -55,10 +55,10 @@ FloatingPointType uniform_rand()
}
template <typename FloatingPointType>
boost::multiprecision::backends::cpp_double_fp_backend<typename FloatingPointType::float_type> uniform_rand()
boost::multiprecision::backends::cpp_double_float<typename FloatingPointType::float_type> uniform_rand()
{
using float_type = typename FloatingPointType::float_type;
return boost::multiprecision::backends::cpp_double_fp_backend<float_type>(uniform_real<float_type>()) * boost::multiprecision::backends::cpp_double_fp_backend<float_type>(uniform_real<float_type>());
return boost::multiprecision::backends::cpp_double_float<float_type>(uniform_real<float_type>()) * boost::multiprecision::backends::cpp_double_float<float_type>(uniform_real<float_type>());
}
template <typename FloatingPointType>
@@ -74,9 +74,9 @@ log_rand()
}
template <typename FloatingPointType>
boost::multiprecision::backends::cpp_double_fp_backend<typename FloatingPointType::float_type> log_rand()
boost::multiprecision::backends::cpp_double_float<typename FloatingPointType::float_type> log_rand()
{
boost::multiprecision::backends::cpp_double_fp_backend<typename FloatingPointType::float_type> a(uniform_rand<boost::multiprecision::backends::cpp_double_fp_backend<typename FloatingPointType::float_type> >() + typename FloatingPointType::float_type(1));
boost::multiprecision::backends::cpp_double_float<typename FloatingPointType::float_type> a(uniform_rand<boost::multiprecision::backends::cpp_double_float<typename FloatingPointType::float_type> >() + typename FloatingPointType::float_type(1));
a *= log_rand<typename FloatingPointType::float_type>();
return a;
}
@@ -152,7 +152,7 @@ bool test_op(char op, const unsigned count = 0x10000U)
std::cerr << std::setprecision(std::numeric_limits<naked_double_float_type>::digits10 + 2);
std::cerr << " [FAILED] while performing '" << std::setprecision(100000) << ctrl_a << "' " << op << " '" << ctrl_b << "', got incorrect result: " << (df_c) << std::endl;
// uncomment for more debugging information (only for cpp_double_fp_backend<> type)
// uncomment for more debugging information (only for cpp_double_float<> type)
std::cerr << "(df_a = " << df_a.get_raw_str() << ", df_b = " << df_b.get_raw_str() << ")" << std::endl;
std::cerr << "expected: " << ctrl_c << std::endl;
std::cerr << "actual : " << ctrl_df_c << " (" << df_c.get_raw_str() << ")" << std::endl;
@@ -198,11 +198,11 @@ int main()
//result_is_ok &= test_arithmetic_cpp_double_float::test_arithmetic<boost::multiprecision::float128>();
#endif
result_is_ok &= test_arithmetic_cpp_double_float::test_arithmetic<boost::multiprecision::backends::cpp_double_fp_backend<float> >();
result_is_ok &= test_arithmetic_cpp_double_float::test_arithmetic<boost::multiprecision::backends::cpp_double_fp_backend<double> >();
result_is_ok &= test_arithmetic_cpp_double_float::test_arithmetic<boost::multiprecision::backends::cpp_double_fp_backend<long double> >();
result_is_ok &= test_arithmetic_cpp_double_float::test_arithmetic<boost::multiprecision::backends::cpp_double_float<float> >();
result_is_ok &= test_arithmetic_cpp_double_float::test_arithmetic<boost::multiprecision::backends::cpp_double_float<double> >();
result_is_ok &= test_arithmetic_cpp_double_float::test_arithmetic<boost::multiprecision::backends::cpp_double_float<long double> >();
#ifdef BOOST_MATH_USE_FLOAT128
result_is_ok &= test_arithmetic_cpp_double_float::test_arithmetic<boost::multiprecision::backends::cpp_double_fp_backend<boost::multiprecision::float128> >();
result_is_ok &= test_arithmetic_cpp_double_float::test_arithmetic<boost::multiprecision::backends::cpp_double_float<boost::multiprecision::float128> >();
#endif
return (result_is_ok ? 0 : -1);
+16 -16
View File
@@ -6,7 +6,7 @@
// (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// Test comparision operators of cpp_double_fp_backend<>
// Test comparision operators of cpp_double_float<>
// Note: This series of tests depend on the correctness of constructor
// so please run test_cpp_double_float_constructors.cpp before this
@@ -68,11 +68,11 @@ FloatingPointType uniform_rand()
}
template <typename FloatingPointType>
boost::multiprecision::backends::cpp_double_fp_backend<typename FloatingPointType::float_type> uniform_rand()
boost::multiprecision::backends::cpp_double_float<typename FloatingPointType::float_type> uniform_rand()
{
using float_type = typename FloatingPointType::float_type;
return boost::multiprecision::backends::cpp_double_fp_backend<float_type>(uniform_real<float_type>())
* boost::multiprecision::backends::cpp_double_fp_backend<float_type>(uniform_real<float_type>());
return boost::multiprecision::backends::cpp_double_float<float_type>(uniform_real<float_type>())
* boost::multiprecision::backends::cpp_double_float<float_type>(uniform_real<float_type>());
}
template <typename NumericType, typename std::enable_if<std::is_integral<NumericType>::value>::type const* = nullptr>
@@ -91,9 +91,9 @@ FloatingPointType log_rand()
}
template <typename FloatingPointType>
boost::multiprecision::backends::cpp_double_fp_backend<typename FloatingPointType::float_type> log_rand()
boost::multiprecision::backends::cpp_double_float<typename FloatingPointType::float_type> log_rand()
{
boost::multiprecision::backends::cpp_double_fp_backend<typename FloatingPointType::float_type> a(uniform_rand<boost::multiprecision::backends::cpp_double_fp_backend<typename FloatingPointType::float_type> >());
boost::multiprecision::backends::cpp_double_float<typename FloatingPointType::float_type> a(uniform_rand<boost::multiprecision::backends::cpp_double_float<typename FloatingPointType::float_type> >());
a *= log_rand<typename FloatingPointType::float_type>();
return a;
}
@@ -101,11 +101,11 @@ boost::multiprecision::backends::cpp_double_fp_backend<typename FloatingPointTyp
template <typename FloatingPointType, typename ComparisionType>
int test()
{
using double_float_t = boost::multiprecision::backends::cpp_double_fp_backend<FloatingPointType>;
using double_float_t = boost::multiprecision::backends::cpp_double_float<FloatingPointType>;
#ifdef BOOST_MATH_USE_FLOAT128
using largest_type = boost::multiprecision::backends::cpp_double_fp_backend<boost::multiprecision::float128>;
using largest_type = boost::multiprecision::backends::cpp_double_float<boost::multiprecision::float128>;
#else
using largest_type = boost::multiprecision::backends::cpp_double_fp_backend<long double>;
using largest_type = boost::multiprecision::backends::cpp_double_float<long double>;
#endif
std::string type_name = typeid(ComparisionType).name();
@@ -268,9 +268,9 @@ int test()
template <typename FloatingPointType>
int test_basic() {
using double_float_t = boost::multiprecision::backends::cpp_double_fp_backend<FloatingPointType>;
using double_float_t = boost::multiprecision::backends::cpp_double_float<FloatingPointType>;
std::cout << "Performing basic comparision tests for cpp_double_fp_backend<" << typeid(FloatingPointType).name() << ">... ";
std::cout << "Performing basic comparision tests for cpp_double_float<" << typeid(FloatingPointType).name() << ">... ";
int i;
for (i = 0; i < 10000; ++i)
@@ -352,7 +352,7 @@ int test_comparison() {
int e = 0;
e += test_cpp_double_comparision::test_basic<FloatingPointType>();
std::cout << "\nTesting comparision operators for cpp_double_fp_backend<" << boost::core::demangle(typeid(FloatingPointType).name()) << ">" << std::endl;
std::cout << "\nTesting comparision operators for cpp_double_float<" << boost::core::demangle(typeid(FloatingPointType).name()) << ">" << std::endl;
e += test_cpp_double_comparision::test<FloatingPointType, unsigned long long>();
e += test_cpp_double_comparision::test<FloatingPointType, signed long long>();
e += test_cpp_double_comparision::test<FloatingPointType, unsigned long>();
@@ -367,11 +367,11 @@ int test_comparison() {
#ifdef BOOST_MATH_USE_FLOAT128
e += test_cpp_double_comparision::test<FloatingPointType, boost::multiprecision::float128>();
#endif
e += test_cpp_double_comparision::test<FloatingPointType, boost::multiprecision::backends::cpp_double_fp_backend<float> >();
e += test_cpp_double_comparision::test<FloatingPointType, boost::multiprecision::backends::cpp_double_fp_backend<double> >();
e += test_cpp_double_comparision::test<FloatingPointType, boost::multiprecision::backends::cpp_double_fp_backend<long double> >();
e += test_cpp_double_comparision::test<FloatingPointType, boost::multiprecision::backends::cpp_double_float<float> >();
e += test_cpp_double_comparision::test<FloatingPointType, boost::multiprecision::backends::cpp_double_float<double> >();
e += test_cpp_double_comparision::test<FloatingPointType, boost::multiprecision::backends::cpp_double_float<long double> >();
#ifdef BOOST_MATH_USE_FLOAT128
e += test_cpp_double_comparision::test<FloatingPointType, boost::multiprecision::backends::cpp_double_fp_backend<boost::multiprecision::float128> >();
e += test_cpp_double_comparision::test<FloatingPointType, boost::multiprecision::backends::cpp_double_float<boost::multiprecision::float128> >();
#endif
std::cout << std::endl;
return e;
+13 -13
View File
@@ -6,7 +6,7 @@
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// Constructor tests for cpp_double_fp_backend<>
// Constructor tests for cpp_double_float<>
// cd /mnt/c/Users/User/Documents/Ks/PC_Software/Test
// g++ -O3 -Wall -march=native -std=c++11 -I/mnt/c/MyGitRepos/BoostGSoC21_multiprecision/include -I/mnt/c/boost/boost_1_76_0 test.cpp -o test_double_float.exe
@@ -75,10 +75,10 @@ FloatingPointType get_rand()
}
template <typename FloatingPointType>
boost::multiprecision::backends::cpp_double_fp_backend<typename FloatingPointType::float_type> get_rand()
boost::multiprecision::backends::cpp_double_float<typename FloatingPointType::float_type> get_rand()
{
using float_type = typename FloatingPointType::float_type;
return boost::multiprecision::backends::cpp_double_fp_backend<float_type>(uniform_real<float_type>()) * boost::multiprecision::backends::cpp_double_fp_backend<float_type>(uniform_real<float_type>());
return boost::multiprecision::backends::cpp_double_float<float_type>(uniform_real<float_type>()) * boost::multiprecision::backends::cpp_double_float<float_type>(uniform_real<float_type>());
}
template <typename ConstructionType, typename ArithmeticType, typename std::enable_if<std::is_arithmetic<ArithmeticType>::value || boost::multiprecision::backends::detail::is_floating_point_or_float128<ArithmeticType>::value>::type const* = nullptr>
@@ -90,7 +90,7 @@ ConstructionType construct_from(ArithmeticType f)
template <typename ConstructionType, typename DoubleFloatType, typename std::enable_if<!(std::is_arithmetic<DoubleFloatType>::value || boost::multiprecision::backends::detail::is_floating_point_or_float128<DoubleFloatType>::value)>::type const* = nullptr>
ConstructionType construct_from(DoubleFloatType f)
{
static_assert(std::is_same< boost::multiprecision::backends::cpp_double_fp_backend<typename DoubleFloatType::float_type>
static_assert(std::is_same< boost::multiprecision::backends::cpp_double_float<typename DoubleFloatType::float_type>
, typename std::decay<DoubleFloatType>::type>::value, "Only double float should come here");
return ConstructionType(f.first()) + ConstructionType(f.second());
}
@@ -98,7 +98,7 @@ ConstructionType construct_from(DoubleFloatType f)
template <typename FloatingPointType, typename NumericType>
int test_constructor()
{
using double_float_t = boost::multiprecision::backends::cpp_double_fp_backend<FloatingPointType>;
using double_float_t = boost::multiprecision::backends::cpp_double_float<FloatingPointType>;
using control_float_type = boost::multiprecision::number<boost::multiprecision::cpp_bin_float<(detail::max)(std::numeric_limits<double_float_t>::digits10, std::numeric_limits<NumericType>::digits10) * 2 + 1>, boost::multiprecision::et_off>;
std::cout << "Testing constructor for ";
@@ -115,11 +115,11 @@ int test_constructor()
typename double_float_t::rep_type rep(d.rep());
double_float_t::normalize_pair(rep);
// Check if representation of the cpp_double_fp_backend is not normalized
// Check if representation of the cpp_double_float is not normalized
if (rep != d.rep())
{
std::cerr << "[FAILED]\nabnormal representation for " << typeid(NumericType).name() << " = " << n
<< " (cpp_double_fp_backend<" << typeid(FloatingPointType).name() << "> = " << d.get_raw_str() << ")" << std::endl;
<< " (cpp_double_float<" << typeid(FloatingPointType).name() << "> = " << d.get_raw_str() << ")" << std::endl;
return -1;
}
@@ -145,10 +145,10 @@ int test_constructor()
template <typename FloatingPointType>
int test_constructors()
{
using double_float_t = boost::multiprecision::backends::cpp_double_fp_backend<FloatingPointType>;
using double_float_t = boost::multiprecision::backends::cpp_double_float<FloatingPointType>;
double_float_t a, b;
std::cout << "Testing cpp_double_fp_backend< " << typeid(FloatingPointType).name() << " >...\n==="
std::cout << "Testing cpp_double_float< " << typeid(FloatingPointType).name() << " >...\n==="
<< std::endl;
int e = 0;
@@ -167,11 +167,11 @@ int test_constructors()
#ifdef BOOST_MATH_USE_FLOAT128
e += test_constructor<FloatingPointType, boost::multiprecision::float128>();
#endif
e += test_constructor<FloatingPointType, boost::multiprecision::backends::cpp_double_fp_backend<float>>();
e += test_constructor<FloatingPointType, boost::multiprecision::backends::cpp_double_fp_backend<double>>();
e += test_constructor<FloatingPointType, boost::multiprecision::backends::cpp_double_fp_backend<long double>>();
e += test_constructor<FloatingPointType, boost::multiprecision::backends::cpp_double_float<float>>();
e += test_constructor<FloatingPointType, boost::multiprecision::backends::cpp_double_float<double>>();
e += test_constructor<FloatingPointType, boost::multiprecision::backends::cpp_double_float<long double>>();
#ifdef BOOST_MATH_USE_FLOAT128
e += test_constructor<FloatingPointType, boost::multiprecision::backends::cpp_double_fp_backend<boost::multiprecision::float128>>();
e += test_constructor<FloatingPointType, boost::multiprecision::backends::cpp_double_float<boost::multiprecision::float128>>();
#endif
if (e == 0)
+19 -19
View File
@@ -29,19 +29,19 @@
namespace std {
// Since there are no longer inner specializations of
// numeric_limits for standalone cpp_double_fp_backend<T>
// and cpp_quad_fp_backend<T> template types, we provide our own
// numeric_limits for standalone cpp_double_float<T>
// and cpp_quad_float<T> template types, we provide our own
// local specializations patched here.
template <typename FloatingPointType>
class numeric_limits<boost::multiprecision::backends::cpp_double_fp_backend<FloatingPointType> >
: public std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_fp_backend<FloatingPointType> > >
class numeric_limits<boost::multiprecision::backends::cpp_double_float<FloatingPointType> >
: public std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<FloatingPointType> > >
{
};
template <typename FloatingPointType>
class numeric_limits<boost::multiprecision::backends::cpp_quad_fp_backend<FloatingPointType> >
: public std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_fp_backend<FloatingPointType> > >
class numeric_limits<boost::multiprecision::backends::cpp_quad_float<FloatingPointType> >
: public std::numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_float<FloatingPointType> > >
{
};
@@ -103,22 +103,22 @@ namespace backends {
template <typename T> int sign(T val) { return (T(0) < val) - (val < T(0)); }
template <typename Rr>
inline cpp_double_fp_backend<Rr> pow(const cpp_double_fp_backend<Rr>& a, int exp)
inline cpp_double_float<Rr> pow(const cpp_double_float<Rr>& a, int exp)
{
return a.pown(a,exp);
}
template <typename Rr, typename Exp>
inline cpp_double_fp_backend<Rr> frexp(const cpp_double_fp_backend<Rr>& a, Exp* b)
inline cpp_double_float<Rr> frexp(const cpp_double_float<Rr>& a, Exp* b)
{
cpp_double_fp_backend<Rr> ret(0);
cpp_double_float<Rr> ret(0);
eval_frexp(ret, a, b);
return ret;
}
template <typename Rr> void print_compound_number(const std::string& prefix, const Rr& arg) {};
template <typename Rr> void print_compound_number(const std::string& prefix, const cpp_double_fp_backend<Rr>& arg);
template <typename Rr> void print_compound_number(const std::string& prefix, const cpp_quad_fp_backend<Rr>& arg);
template <typename Rr> void print_compound_number(const std::string& prefix, const cpp_double_float<Rr>& arg);
template <typename Rr> void print_compound_number(const std::string& prefix, const cpp_quad_float<Rr>& arg);
template<typename R>
struct double_or_quad_traits {
@@ -128,14 +128,14 @@ struct double_or_quad_traits {
};
template<typename R>
struct double_or_quad_traits<cpp_double_fp_backend<R>> {
struct double_or_quad_traits<cpp_double_float<R>> {
static constexpr auto guard_bits = 3;
static constexpr auto double_or_quad_multiplier = 2;
using underlying_type = R;
};
template<typename R>
struct double_or_quad_traits<cpp_quad_fp_backend<R>> {
struct double_or_quad_traits<cpp_quad_float<R>> {
static constexpr auto guard_bits = 4;
static constexpr auto double_or_quad_multiplier = 4;
using underlying_type = R;
@@ -237,7 +237,7 @@ public:
}
};
template <typename Rr> void print_compound_number(const std::string& prefix, const boost::multiprecision::backends::cpp_double_fp_backend<Rr>& arg) {
template <typename Rr> void print_compound_number(const std::string& prefix, const boost::multiprecision::backends::cpp_double_float<Rr>& arg) {
std::cout << std::left << std::setw(15) << prefix+".first " << " = " << std::right; auto ex1 = DecomposedReal(arg.crep().first).short_print_shifted();
if(arg.crep().second != 0) {
std::cout << std::left << std::setw(15) << prefix+".second " << " = " << std::right; DecomposedReal(arg.crep().second).short_print_shifted(ex1,false);
@@ -245,7 +245,7 @@ template <typename Rr> void print_compound_number(const std::string& prefix, con
}
// not tested
template <typename Rr> void print_compound_number(const std::string& prefix, const boost::multiprecision::backends::cpp_quad_fp_backend<Rr>& arg) {
template <typename Rr> void print_compound_number(const std::string& prefix, const boost::multiprecision::backends::cpp_quad_float<Rr>& arg) {
std::cout << std::left << std::setw(15) << prefix+".first " << " = " << std::right; auto ex1 = DecomposedReal(get<0>(arg.crep())).short_print_shifted();
if(get<1>(arg.crep()) != 0) {
std::cout << std::left << std::setw(15) << prefix+".second " << " = " << std::right; DecomposedReal(get<1>(arg.crep())).short_print_shifted(ex1,false);
@@ -282,7 +282,7 @@ template <typename Rr> int test_number_decomposition(const Rr& arg, bool verbose
DecomposedReal d(arg);
auto rebuilt = d.rebuild<Rr>();
// FIXME: should these normalize calls be here, ot at the end of some functions inside cpp_double_fp_backend.hpp ?
// FIXME: should these normalize calls be here, ot at the end of some functions inside cpp_double_float.hpp ?
Rr::arithmetic::normalize(rebuilt.rep());
Rr::arithmetic::extra_normalize(rebuilt.rep());
@@ -337,7 +337,7 @@ int try_number(R& ref, Arg str, bool verbose) {
int errors = 0;
try {
// FIXME: should these normalize calls be here, ot at the end of some functions inside cpp_double_fp_backend.hpp ?
// FIXME: should these normalize calls be here, ot at the end of some functions inside cpp_double_float.hpp ?
R::arithmetic::normalize(z.rep());
R::arithmetic::extra_normalize(z.rep());
@@ -397,8 +397,8 @@ int test() {
return errors;
}
template<class R> using double_float = boost::multiprecision::backends::cpp_double_fp_backend<R>;
template<class R> using quad_float = boost::multiprecision::backends::cpp_quad_fp_backend<R>;
template<class R> using double_float = boost::multiprecision::backends::cpp_double_float<R>;
template<class R> using quad_float = boost::multiprecision::backends::cpp_quad_float<R>;
int main()
{
+4 -4
View File
@@ -59,7 +59,7 @@ void represent_tgamma_half()
int main()
{
{
using double_float_type = boost::multiprecision::number<boost::multiprecision::backends::cpp_double_fp_backend<float>, boost::multiprecision::et_off>;
using double_float_type = boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<float>, boost::multiprecision::et_off>;
using dec_float_type = boost::multiprecision::number<boost::multiprecision::cpp_dec_float<std::numeric_limits<double_float_type>::digits10>, boost::multiprecision::et_off>;
const double_float_type lg = log(double_float_type(602) / double_float_type(100));
@@ -76,7 +76,7 @@ int main()
}
{
using double_float_type = boost::multiprecision::number<boost::multiprecision::backends::cpp_double_fp_backend<double>, boost::multiprecision::et_off>;
using double_float_type = boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<double>, boost::multiprecision::et_off>;
using dec_float_type = boost::multiprecision::number<boost::multiprecision::cpp_dec_float<std::numeric_limits<double_float_type>::digits10>, boost::multiprecision::et_off>;
represent_tgamma_half<double_float_type>();
@@ -87,7 +87,7 @@ int main()
}
{
using double_float_type = boost::multiprecision::number<boost::multiprecision::backends::cpp_double_fp_backend<long double>, boost::multiprecision::et_off>;
using double_float_type = boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<long double>, boost::multiprecision::et_off>;
using dec_float_type = boost::multiprecision::number<boost::multiprecision::cpp_dec_float<std::numeric_limits<double_float_type>::digits10>, boost::multiprecision::et_off>;
represent_tgamma_half<double_float_type>();
@@ -99,7 +99,7 @@ int main()
#if defined(BOOST_MATH_USE_FLOAT128)
{
using double_float_type = boost::multiprecision::number<boost::multiprecision::backends::cpp_double_fp_backend<boost::multiprecision::float128>, boost::multiprecision::et_off>;
using double_float_type = boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<boost::multiprecision::float128>, boost::multiprecision::et_off>;
using dec_float_type = boost::multiprecision::number<boost::multiprecision::cpp_dec_float<std::numeric_limits<double_float_type>::digits10>, boost::multiprecision::et_off>;
represent_tgamma_half<double_float_type>();
+7 -7
View File
@@ -6,8 +6,8 @@
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// Basic I/O tests for cpp_double_fp_backend<>
// Note that the I/O of cpp_double_fp_backend<> is currently extremely underdeveloped
// Basic I/O tests for cpp_double_float<>
// Note that the I/O of cpp_double_float<> is currently extremely underdeveloped
#include <boost/config.hpp>
@@ -35,10 +35,10 @@ FloatingPointType uniform_real()
}
template <typename FloatingPointType>
boost::multiprecision::backends::cpp_double_fp_backend<typename FloatingPointType::float_type> uniform_rand()
boost::multiprecision::backends::cpp_double_float<typename FloatingPointType::float_type> uniform_rand()
{
using float_type = typename FloatingPointType::float_type;
return boost::multiprecision::backends::cpp_double_fp_backend<float_type>(uniform_real<float_type>()) * boost::multiprecision::backends::cpp_double_fp_backend<float_type>(uniform_real<float_type>());
return boost::multiprecision::backends::cpp_double_float<float_type>(uniform_real<float_type>()) * boost::multiprecision::backends::cpp_double_float<float_type>(uniform_real<float_type>());
}
int rand_in_range(int a, int b)
@@ -52,13 +52,13 @@ FloatingPointType log_rand()
if (uniform_real<float>() < (1. / 100.))
return 0; // throw in a few zeroes
using std::ldexp;
return ldexp(uniform_real<FloatingPointType>(), rand_in_range(std::numeric_limits<boost::multiprecision::backends::cpp_double_fp_backend<FloatingPointType> >::min_exponent, std::numeric_limits<boost::multiprecision::backends::cpp_double_fp_backend<FloatingPointType> >::max_exponent));
return ldexp(uniform_real<FloatingPointType>(), rand_in_range(std::numeric_limits<boost::multiprecision::backends::cpp_double_float<FloatingPointType> >::min_exponent, std::numeric_limits<boost::multiprecision::backends::cpp_double_float<FloatingPointType> >::max_exponent));
}
template <typename FloatingPointType>
void test()
{
using double_float_t = boost::multiprecision::backends::cpp_double_fp_backend<FloatingPointType>;
using double_float_t = boost::multiprecision::backends::cpp_double_float<FloatingPointType>;
bool passed = true;
int i;
@@ -132,7 +132,7 @@ void test()
}
}
std::cout << "cpp_double_fp_backend<" << typeid(FloatingPointType).name() << ">: "
std::cout << "cpp_double_float<" << typeid(FloatingPointType).name() << ">: "
<< (passed ? "PASS" : "FAIL") << " (" << i << " tests)" << std::endl;
}
} // namespace test_cpp_double_float_io
+7 -7
View File
@@ -6,8 +6,8 @@
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// Basic I/O tests for cpp_double_fp_backend<>
// Note that the I/O of cpp_double_fp_backend<> is currently extremely underdeveloped
// Basic I/O tests for cpp_double_float<>
// Note that the I/O of cpp_double_float<> is currently extremely underdeveloped
#include <boost/config.hpp>
#include <boost/multiprecision/number.hpp>
@@ -22,9 +22,9 @@
template <typename FloatingPointType>
void test_basic_io_manual()
{
using double_float_t = boost::multiprecision::backends::cpp_double_fp_backend<FloatingPointType>;
using double_float_t = boost::multiprecision::backends::cpp_double_float<FloatingPointType>;
std::cout << "Testing cpp_double_fp_backend< " << typeid(FloatingPointType).name() << " >...\n"
std::cout << "Testing cpp_double_float< " << typeid(FloatingPointType).name() << " >...\n"
<< std::endl;
double_float_t a, b;
@@ -113,9 +113,9 @@ void test_basic_io_manual()
int main()
{
test_basic_io_manual<boost::multiprecision::backends::cpp_double_fp_backend<double>>();
test_basic_io_manual < boost::multiprecision::backends::cpp_double_fp_backend<float>>();
//test_basic_io_manual < boost::multiprecision::backends::cpp_double_fp_backend<long double>>();
test_basic_io_manual<boost::multiprecision::backends::cpp_double_float<double>>();
test_basic_io_manual < boost::multiprecision::backends::cpp_double_float<float>>();
//test_basic_io_manual < boost::multiprecision::backends::cpp_double_float<long double>>();
#ifdef BOOST_MATH_USE_FLOAT128
// FIXME:
// test_basic_io_manual<boost::multiprecision::float128>();
+1 -1
View File
@@ -54,7 +54,7 @@ namespace local
static unsigned seed_prescaler;
using quad_float_type = boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_fp_backend<float_type>, boost::multiprecision::et_off>;
using quad_float_type = boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_float<float_type>, boost::multiprecision::et_off>;
using control_float_type = boost::multiprecision::number<boost::multiprecision::cpp_dec_float<(2 * std::numeric_limits<quad_float_type>::digits10) + 1>, boost::multiprecision::et_off>;
static_assert( digits == std::numeric_limits<quad_float_type>::digits , "Error in digit parameters" );
+16 -16
View File
@@ -6,7 +6,7 @@
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// Constructor tests for cpp_quad_fp_backend<>
// Constructor tests for cpp_quad_float<>
#include <boost/config.hpp>
#include <boost/multiprecision/number.hpp>
@@ -71,13 +71,13 @@ FloatingPointType get_rand()
}
template <typename FloatingPointType>
boost::multiprecision::backends::cpp_quad_fp_backend<typename FloatingPointType::float_type> get_rand()
boost::multiprecision::backends::cpp_quad_float<typename FloatingPointType::float_type> get_rand()
{
using float_type = typename FloatingPointType::float_type;
return boost::multiprecision::backends::cpp_quad_fp_backend<float_type>(uniform_real<float_type>())
* boost::multiprecision::backends::cpp_quad_fp_backend<float_type>(uniform_real<float_type>())
* boost::multiprecision::backends::cpp_quad_fp_backend<float_type>(uniform_real<float_type>())
* boost::multiprecision::backends::cpp_quad_fp_backend<float_type>(uniform_real<float_type>());
return boost::multiprecision::backends::cpp_quad_float<float_type>(uniform_real<float_type>())
* boost::multiprecision::backends::cpp_quad_float<float_type>(uniform_real<float_type>())
* boost::multiprecision::backends::cpp_quad_float<float_type>(uniform_real<float_type>())
* boost::multiprecision::backends::cpp_quad_float<float_type>(uniform_real<float_type>());
}
template <typename ConstructionType, typename ArithmeticType, typename std::enable_if<std::is_arithmetic<ArithmeticType>::value || boost::multiprecision::backends::detail::is_floating_point_or_float128<ArithmeticType>::value>::type const* = nullptr>
@@ -89,14 +89,14 @@ ConstructionType construct_from(ArithmeticType f)
template <typename ConstructionType, typename QuadFloatType, typename std::enable_if<!(std::is_arithmetic<QuadFloatType>::value || boost::multiprecision::backends::detail::is_floating_point_or_float128<QuadFloatType>::value)>::type const* = nullptr>
ConstructionType construct_from(QuadFloatType f)
{
static_assert(std::is_same<boost::multiprecision::backends::cpp_quad_fp_backend<typename QuadFloatType::float_type>, typename std::decay<QuadFloatType>::type>::value, "Only quad float should come here");
static_assert(std::is_same<boost::multiprecision::backends::cpp_quad_float<typename QuadFloatType::float_type>, typename std::decay<QuadFloatType>::type>::value, "Only quad float should come here");
return ConstructionType(std::get<0>(f.rep())) + ConstructionType(std::get<1>(f.rep())) + ConstructionType(std::get<2>(f.rep())) + ConstructionType(std::get<3>(f.rep()));
}
template <typename FloatingPointType, typename NumericType>
int test_constructor()
{
using quad_float_t = boost::multiprecision::backends::cpp_quad_fp_backend<FloatingPointType>;
using quad_float_t = boost::multiprecision::backends::cpp_quad_float<FloatingPointType>;
using control_float_type = boost::multiprecision::number<boost::multiprecision::cpp_bin_float<(detail::max)(std::numeric_limits<quad_float_t>::digits10, std::numeric_limits<NumericType>::digits10) * 2 + 1>, boost::multiprecision::et_off>;
std::cout << "Testing constructor for ";
@@ -113,11 +113,11 @@ int test_constructor()
typename quad_float_t::rep_type rep(d.rep());
quad_float_t::arithmetic::normalize(rep);
// Check if representation of the cpp_quad_fp_backend is not normalized
// Check if representation of the cpp_quad_float is not normalized
if (rep != d.rep())
{
std::cerr << "[FAILED]\nabnormal representation for " << typeid(NumericType).name() << " = " << n
<< " (cpp_quad_fp_backend<" << typeid(FloatingPointType).name() << "> = " << d.raw_str() << ")" << std::endl;
<< " (cpp_quad_float<" << typeid(FloatingPointType).name() << "> = " << d.raw_str() << ")" << std::endl;
return -1;
}
@@ -145,10 +145,10 @@ int test_constructor()
template <typename FloatingPointType>
int test_constructors()
{
using quad_float_t = boost::multiprecision::backends::cpp_quad_fp_backend<FloatingPointType>;
using quad_float_t = boost::multiprecision::backends::cpp_quad_float<FloatingPointType>;
quad_float_t a, b;
std::cout << "Testing cpp_quad_fp_backend< " << typeid(FloatingPointType).name() << " >...\n==="
std::cout << "Testing cpp_quad_float< " << typeid(FloatingPointType).name() << " >...\n==="
<< std::endl;
int e = 0;
@@ -167,11 +167,11 @@ int test_constructors()
#ifdef BOOST_MATH_USE_FLOAT128
e += test_constructor<FloatingPointType, boost::multiprecision::float128>();
#endif
e += test_constructor<FloatingPointType, boost::multiprecision::backends::cpp_quad_fp_backend<float> >();
e += test_constructor<FloatingPointType, boost::multiprecision::backends::cpp_quad_fp_backend<double> >();
e += test_constructor<FloatingPointType, boost::multiprecision::backends::cpp_quad_fp_backend<long double> >();
e += test_constructor<FloatingPointType, boost::multiprecision::backends::cpp_quad_float<float> >();
e += test_constructor<FloatingPointType, boost::multiprecision::backends::cpp_quad_float<double> >();
e += test_constructor<FloatingPointType, boost::multiprecision::backends::cpp_quad_float<long double> >();
#ifdef BOOST_MATH_USE_FLOAT128
e += test_constructor<FloatingPointType, boost::multiprecision::backends::cpp_quad_fp_backend<boost::multiprecision::float128> >();
e += test_constructor<FloatingPointType, boost::multiprecision::backends::cpp_quad_float<boost::multiprecision::float128> >();
#endif
if (e == 0)
+3 -3
View File
@@ -69,7 +69,7 @@ void represent_tgamma_half()
int main()
{
{
using quad_float_type = boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_fp_backend<double>, boost::multiprecision::et_off>;
using quad_float_type = boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_float<double>, boost::multiprecision::et_off>;
using dec_float_type = boost::multiprecision::number<boost::multiprecision::cpp_dec_float<std::numeric_limits<quad_float_type>::digits10>, boost::multiprecision::et_off>;
represent_tgamma_half<quad_float_type>();
@@ -80,7 +80,7 @@ int main()
}
{
using quad_float_type = boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_fp_backend<long double>, boost::multiprecision::et_off>;
using quad_float_type = boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_float<long double>, boost::multiprecision::et_off>;
using dec_float_type = boost::multiprecision::number<boost::multiprecision::cpp_dec_float<std::numeric_limits<quad_float_type>::digits10>, boost::multiprecision::et_off>;
represent_tgamma_half<quad_float_type>();
@@ -92,7 +92,7 @@ int main()
#if defined(BOOST_MATH_USE_FLOAT128)
{
using quad_float_type = boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_fp_backend<boost::multiprecision::float128>, boost::multiprecision::et_off>;
using quad_float_type = boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_float<boost::multiprecision::float128>, boost::multiprecision::et_off>;
using dec_float_type = boost::multiprecision::number<boost::multiprecision::cpp_dec_float<std::numeric_limits<quad_float_type>::digits10>, boost::multiprecision::et_off>;
represent_tgamma_half<quad_float_type>();
+7 -7
View File
@@ -274,18 +274,18 @@ int main()
test<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<35, boost::multiprecision::digit_base_10, std::allocator<char>, boost::long_long_type> > >();
#endif
#ifdef TEST_CPP_DOUBLE_FLOAT
test<boost::multiprecision::cpp_double_float>();
test<boost::multiprecision::cpp_double_double>();
test<boost::multiprecision::cpp_double_long_double>();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<float> > >();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<double> > >();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<long double> > >();
#if defined(BOOST_MATH_USE_FLOAT128)
test<boost::multiprecision::cpp_double_float128>();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<boost::multiprecision::float128> > >();
#endif
#endif
#ifdef TEST_CPP_QUAD_FLOAT
test<boost::multiprecision::cpp_quad_double>();
test<boost::multiprecision::cpp_quad_long_double>();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_float<double> > >();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_float<long double> > >();
#if defined(BOOST_MATH_USE_FLOAT128)
test<boost::multiprecision::cpp_quad_float128>();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_float<boost::multiprecision::float128> > >();
#endif
#endif
return boost::report_errors();
+7 -7
View File
@@ -883,18 +883,18 @@ int main()
test<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<35, boost::multiprecision::digit_base_10, std::allocator<char>, boost::long_long_type> > >();
#endif
#ifdef TEST_CPP_DOUBLE_FLOAT
test<boost::multiprecision::cpp_double_float>();
test<boost::multiprecision::cpp_double_double>();
test<boost::multiprecision::cpp_double_long_double>();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<float> > >();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<double> > >();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<long double> > >();
#if defined(BOOST_MATH_USE_FLOAT128)
test<boost::multiprecision::cpp_double_float128>();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<boost::multiprecision::float128> > >();
#endif
#endif
#ifdef TEST_CPP_DOUBLE_FLOAT
test<boost::multiprecision::cpp_quad_double>();
test<boost::multiprecision::cpp_quad_long_double>();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_float<double> > >();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_float<long double> > >();
#if defined(BOOST_MATH_USE_FLOAT128)
test<boost::multiprecision::cpp_quad_float128>();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_float<boost::multiprecision::float128> > >();
#endif
#endif
return boost::report_errors();
+7 -7
View File
@@ -384,18 +384,18 @@ int main()
test<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<35, boost::multiprecision::digit_base_10, std::allocator<char>, boost::long_long_type> > >();
#endif
#ifdef TEST_CPP_DOUBLE_FLOAT
test<boost::multiprecision::cpp_double_float>();
test<boost::multiprecision::cpp_double_double>();
test<boost::multiprecision::cpp_double_long_double>();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<float> > >();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<double> > >();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<long double> > >();
#if defined(BOOST_MATH_USE_FLOAT128)
test<boost::multiprecision::cpp_double_float128>();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<boost::multiprecision::float128> > >();
#endif
#endif
#ifdef TEST_CPP_QUAD_FLOAT
test<boost::multiprecision::cpp_quad_double>();
test<boost::multiprecision::cpp_quad_long_double>();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_float<double> > >();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_float<long double> > >();
#if defined(BOOST_MATH_USE_FLOAT128)
//test<boost::multiprecision::cpp_quad_float128>();
//test<boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_float<boost::multiprecision::float128> > >();
#endif
#endif
return boost::report_errors();
+4 -4
View File
@@ -262,11 +262,11 @@ int main()
test<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<35, boost::multiprecision::digit_base_10, std::allocator<char>, boost::long_long_type> > >();
#endif
#ifdef TEST_CPP_DOUBLE_FLOAT
test<boost::multiprecision::cpp_double_float>();
test<boost::multiprecision::cpp_double_double>();
test<boost::multiprecision::cpp_double_long_double>();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<float> > >();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<double> > >();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<long double> > >();
#if defined(BOOST_MATH_USE_FLOAT128)
test<boost::multiprecision::cpp_double_float128>();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<boost::multiprecision::float128> > >();
#endif
#endif
return boost::report_errors();
+8 -7
View File
@@ -250,18 +250,19 @@ int main()
test<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<35, boost::multiprecision::digit_base_10, std::allocator<char>, boost::long_long_type> > >();
#endif
#ifdef TEST_CPP_DOUBLE_FLOAT
test<boost::multiprecision::cpp_double_float>();
test<boost::multiprecision::cpp_double_double>();
test<boost::multiprecision::cpp_double_long_double>();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<float> > >();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<double> > >();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<long double> > >();
#if defined(BOOST_MATH_USE_FLOAT128)
test<boost::multiprecision::cpp_double_float128>();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<boost::multiprecision::float128> > >();
#endif
#endif
#ifdef TEST_CPP_QUAD_FLOAT
test<boost::multiprecision::cpp_quad_double>();
test<boost::multiprecision::cpp_quad_long_double>();
//test<boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_float<float> > >();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_float<double> > >();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_float<long double> > >();
#if defined(BOOST_MATH_USE_FLOAT128)
test<boost::multiprecision::cpp_quad_float128>();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_quad_float<boost::multiprecision::float128> > >();
#endif
#endif
return boost::report_errors();
+4 -4
View File
@@ -664,11 +664,11 @@ int main()
test<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<35, boost::multiprecision::digit_base_10, std::allocator<char>, boost::long_long_type> > >();
#endif
#ifdef TEST_CPP_DOUBLE_FLOAT
test<boost::multiprecision::cpp_double_float>();
test<boost::multiprecision::cpp_double_double>();
test<boost::multiprecision::cpp_double_long_double>();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<float> > >();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<double> > >();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<long double> > >();
#if defined(BOOST_MATH_USE_FLOAT128)
test<boost::multiprecision::cpp_double_float128>();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<boost::multiprecision::float128> > >();
#endif
#endif
return boost::report_errors();
+4 -4
View File
@@ -178,11 +178,11 @@ int main()
test<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<35, boost::multiprecision::digit_base_10, std::allocator<char>, boost::long_long_type> > >();
#endif
#ifdef TEST_CPP_DOUBLE_FLOAT
test<boost::multiprecision::cpp_double_float>();
test<boost::multiprecision::cpp_double_double>();
test<boost::multiprecision::cpp_double_long_double>();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<float> > >();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<double> > >();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<long double> > >();
#if defined(BOOST_MATH_USE_FLOAT128)
test<boost::multiprecision::cpp_double_float128>();
test<boost::multiprecision::number<boost::multiprecision::backends::cpp_double_float<boost::multiprecision::float128> > >();
#endif
#endif
return boost::report_errors();