update boost
This commit is contained in:
@@ -4,96 +4,64 @@
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_MP_EXPLICIT_CONVERTIBLE_HPP
|
||||
#define BOOST_MP_EXPLICIT_CONVERTIBLE_HPP
|
||||
#ifndef BOOST_MP_EXPLICIT_CONVERSION_HPP
|
||||
#define BOOST_MP_EXPLICIT_CONVERSION_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/type_traits/conditional.hpp>
|
||||
#include <boost/type_traits/integral_constant.hpp>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
#include <boost/type_traits/declval.hpp>
|
||||
#include <type_traits>
|
||||
#include <boost/multiprecision/detail/standalone_config.hpp>
|
||||
#include <boost/multiprecision/detail/number_base.hpp> // number_category
|
||||
|
||||
namespace boost {
|
||||
namespace multiprecision {
|
||||
namespace detail {
|
||||
namespace multiprecision {
|
||||
namespace detail {
|
||||
|
||||
template <unsigned int N>
|
||||
struct dummy_size {};
|
||||
template <unsigned int N>
|
||||
struct dummy_size
|
||||
{};
|
||||
|
||||
template<typename S, typename T>
|
||||
struct has_generic_interconversion
|
||||
{
|
||||
typedef typename boost::conditional <
|
||||
is_number<S>::value && is_number<T>::value,
|
||||
typename boost::conditional <
|
||||
number_category<S>::value == number_kind_integer,
|
||||
typename boost::conditional<
|
||||
number_category<T>::value == number_kind_integer
|
||||
|| number_category<T>::value == number_kind_floating_point
|
||||
|| number_category<T>::value == number_kind_rational
|
||||
|| number_category<T>::value == number_kind_fixed_point,
|
||||
boost::true_type,
|
||||
boost::false_type
|
||||
>::type,
|
||||
typename boost::conditional<
|
||||
template <typename S, typename T>
|
||||
struct has_generic_interconversion
|
||||
{
|
||||
using type = typename std::conditional<
|
||||
is_number<S>::value && is_number<T>::value,
|
||||
typename std::conditional<
|
||||
number_category<S>::value == number_kind_integer,
|
||||
typename std::conditional<
|
||||
number_category<T>::value == number_kind_integer || number_category<T>::value == number_kind_floating_point || number_category<T>::value == number_kind_rational || number_category<T>::value == number_kind_fixed_point,
|
||||
std::true_type,
|
||||
std::false_type >::type,
|
||||
typename std::conditional<
|
||||
number_category<S>::value == number_kind_rational,
|
||||
typename boost::conditional<
|
||||
number_category<T>::value == number_kind_rational
|
||||
|| number_category<T>::value == number_kind_rational,
|
||||
boost::true_type,
|
||||
boost::false_type
|
||||
>::type,
|
||||
typename boost::conditional<
|
||||
number_category<T>::value == number_kind_floating_point,
|
||||
boost::true_type,
|
||||
boost::false_type
|
||||
>::type
|
||||
>::type
|
||||
> ::type,
|
||||
boost::false_type
|
||||
> ::type type;
|
||||
};
|
||||
typename std::conditional<
|
||||
number_category<T>::value == number_kind_rational || number_category<T>::value == number_kind_rational,
|
||||
std::true_type,
|
||||
std::false_type >::type,
|
||||
typename std::conditional<
|
||||
number_category<T>::value == number_kind_floating_point,
|
||||
std::true_type,
|
||||
std::false_type >::type>::type>::type,
|
||||
std::false_type >::type;
|
||||
};
|
||||
|
||||
template<typename S, typename T>
|
||||
struct is_explicitly_convertible_imp
|
||||
{
|
||||
#ifndef BOOST_NO_SFINAE_EXPR
|
||||
template<typename S1, typename T1>
|
||||
static type_traits::yes_type selector(dummy_size<sizeof(new T1(boost::declval<
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
S1
|
||||
#else
|
||||
S1 const&
|
||||
#endif
|
||||
>()))>*);
|
||||
template <typename S, typename T>
|
||||
struct is_explicitly_convertible_imp
|
||||
{
|
||||
template <typename S1, typename T1>
|
||||
static int selector(dummy_size<static_cast<unsigned int>(sizeof(new T1(std::declval<S1>())))>*);
|
||||
|
||||
template<typename S1, typename T1>
|
||||
static type_traits::no_type selector(...);
|
||||
template <typename S1, typename T1>
|
||||
static char selector(...);
|
||||
|
||||
static const bool value = sizeof(selector<S, T>(0)) == sizeof(type_traits::yes_type);
|
||||
static constexpr bool value = sizeof(selector<S, T>(nullptr)) == sizeof(int);
|
||||
|
||||
typedef boost::integral_constant<bool, value> type;
|
||||
#else
|
||||
typedef typename has_generic_interconversion<S, T>::type gen_type;
|
||||
typedef boost::integral_constant<bool, boost::is_convertible<S, T>::value || gen_type::value> type;
|
||||
#endif
|
||||
};
|
||||
using type = std::integral_constant<bool, value>;
|
||||
};
|
||||
|
||||
template<typename From, typename To>
|
||||
template <typename From, typename To>
|
||||
struct is_explicitly_convertible : public is_explicitly_convertible_imp<From, To>::type
|
||||
{
|
||||
};
|
||||
|
||||
#ifdef BOOST_NO_SFINAE_EXPR
|
||||
template<class Backend1, expression_template_option ExpressionTemplates1, class Backend2, expression_template_option ExpressionTemplates2>
|
||||
struct is_explicitly_convertible<number<Backend1, ExpressionTemplates1>, number<Backend2, ExpressionTemplates2> >
|
||||
: public is_explicitly_convertible<Backend1, Backend2>
|
||||
{
|
||||
};
|
||||
#endif
|
||||
|
||||
}}} // namespaces
|
||||
}}} // namespace boost::multiprecision::detail
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
///////////////////////////////////////////////////////////////
|
||||
// Copyright 2012 John Maddock. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
|
||||
// LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#ifndef BOOST_MATH_EXTRACT_EXPONENT_HPP
|
||||
#define BOOST_MATH_EXTRACT_EXPONENT_HPP
|
||||
#ifndef BOOST_MP_EXTRACT_EXPONENT_TYPE_HPP
|
||||
#define BOOST_MP_EXTRACT_EXPONENT_TYPE_HPP
|
||||
|
||||
#include <boost/multiprecision/number.hpp>
|
||||
|
||||
namespace boost{
|
||||
namespace multiprecision{
|
||||
namespace backends{
|
||||
namespace boost {
|
||||
namespace multiprecision {
|
||||
namespace backends {
|
||||
|
||||
template <class Backend, int cat>
|
||||
struct extract_exponent_type
|
||||
{
|
||||
typedef int type;
|
||||
using type = int;
|
||||
};
|
||||
template <class Backend>
|
||||
struct extract_exponent_type<Backend, number_kind_floating_point>
|
||||
{
|
||||
typedef typename Backend::exponent_type type;
|
||||
using type = typename Backend::exponent_type;
|
||||
};
|
||||
|
||||
}}} // namespaces
|
||||
}}} // namespace boost::multiprecision::backends
|
||||
|
||||
#endif
|
||||
|
||||
@@ -6,58 +6,86 @@
|
||||
#ifndef BOOST_MP_IS_BACKEND_HPP
|
||||
#define BOOST_MP_IS_BACKEND_HPP
|
||||
|
||||
#include <boost/mpl/has_xxx.hpp>
|
||||
#include <boost/type_traits/conditional.hpp>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
#include <type_traits>
|
||||
#include <boost/multiprecision/detail/number_base.hpp>
|
||||
|
||||
namespace boost{ namespace multiprecision{ namespace detail{
|
||||
namespace boost { namespace multiprecision { namespace detail {
|
||||
|
||||
BOOST_MPL_HAS_XXX_TRAIT_DEF(signed_types)
|
||||
BOOST_MPL_HAS_XXX_TRAIT_DEF(unsigned_types)
|
||||
BOOST_MPL_HAS_XXX_TRAIT_DEF(float_types)
|
||||
template <class T>
|
||||
struct has_signed_types
|
||||
{
|
||||
template <class U>
|
||||
static double check(U*, typename U::signed_types* = nullptr);
|
||||
static char check(...);
|
||||
static T* get();
|
||||
static constexpr bool value = sizeof(check(get())) == sizeof(double);
|
||||
};
|
||||
template <class T>
|
||||
struct has_unsigned_types
|
||||
{
|
||||
template <class U>
|
||||
static double check(U*, typename U::unsigned_types* = nullptr);
|
||||
static char check(...);
|
||||
static T* get();
|
||||
static constexpr bool value = sizeof(check(get())) == sizeof(double);
|
||||
};
|
||||
template <class T>
|
||||
struct has_float_types
|
||||
{
|
||||
template <class U>
|
||||
static double check(U*, typename U::float_types* = nullptr);
|
||||
static char check(...);
|
||||
static T* get();
|
||||
static constexpr bool value = sizeof(check(get())) == sizeof(double);
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct is_backend
|
||||
{
|
||||
static const bool value = has_signed_types<T>::value && has_unsigned_types<T>::value && has_float_types<T>::value;
|
||||
};
|
||||
template <class T>
|
||||
struct is_backend : public std::integral_constant<bool, has_signed_types<T>::value && has_unsigned_types<T>::value && has_float_types<T>::value> {};
|
||||
|
||||
template <class Backend>
|
||||
struct other_backend
|
||||
{
|
||||
typedef typename boost::conditional<
|
||||
boost::is_same<number<Backend>, number<Backend, et_on> >::value,
|
||||
number<Backend, et_off>, number<Backend, et_on> >::type type;
|
||||
};
|
||||
template <class Backend>
|
||||
struct other_backend
|
||||
{
|
||||
using type = typename std::conditional<
|
||||
std::is_same<number<Backend>, number<Backend, et_on> >::value,
|
||||
number<Backend, et_off>, number<Backend, et_on> >::type;
|
||||
};
|
||||
|
||||
template <class B, class V>
|
||||
struct number_from_backend
|
||||
{
|
||||
typedef typename boost::conditional <
|
||||
boost::is_convertible<V, number<B> >::value,
|
||||
number<B>,
|
||||
typename other_backend<B>::type > ::type type;
|
||||
};
|
||||
template <class B, class V>
|
||||
struct number_from_backend
|
||||
{
|
||||
using type = typename std::conditional<
|
||||
std::is_convertible<V, number<B> >::value,
|
||||
number<B>,
|
||||
typename other_backend<B>::type>::type;
|
||||
};
|
||||
|
||||
template <bool b, class T, class U>
|
||||
struct is_first_backend_imp{ static const bool value = false; };
|
||||
template <class T, class U>
|
||||
struct is_first_backend_imp<true, T, U>{ static const bool value = is_convertible<U, number<T, et_on> >::value || is_convertible<U, number<T, et_off> >::value; };
|
||||
template <bool b, class T, class U>
|
||||
struct is_first_backend_imp : public std::false_type {};
|
||||
|
||||
template <class T, class U>
|
||||
struct is_first_backend : is_first_backend_imp<is_backend<T>::value, T, U> {};
|
||||
template <class T, class U>
|
||||
struct is_first_backend_imp<true, T, U> : public std::integral_constant < bool, std::is_convertible<U, number<T, et_on> >::value || std::is_convertible<U, number<T, et_off> >::value> {};
|
||||
|
||||
template <bool b, class T, class U>
|
||||
struct is_second_backend_imp{ static const bool value = false; };
|
||||
template <class T, class U>
|
||||
struct is_second_backend_imp<true, T, U>{ static const bool value = (is_convertible<T, number<U, et_on> >::value || is_convertible<T, number<U, et_off> >::value) && !is_first_backend<T, U>::value; };
|
||||
template <class T, class U>
|
||||
struct is_first_backend : is_first_backend_imp<is_backend<T>::value, T, U>
|
||||
{};
|
||||
|
||||
template <class T, class U>
|
||||
struct is_second_backend : is_second_backend_imp<is_backend<U>::value, T, U> {};
|
||||
template <bool b, class T, class U>
|
||||
struct is_second_backend_imp
|
||||
{
|
||||
static constexpr bool value = false;
|
||||
};
|
||||
template <class T, class U>
|
||||
struct is_second_backend_imp<true, T, U>
|
||||
{
|
||||
static constexpr bool value = (std::is_convertible<T, number<U, et_on> >::value || std::is_convertible<T, number<U, et_off> >::value) && !is_first_backend<T, U>::value;
|
||||
};
|
||||
|
||||
template <class T, class U>
|
||||
struct is_second_backend : is_second_backend_imp<is_backend<U>::value, T, U>
|
||||
{};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace boost::multiprecision::detail
|
||||
|
||||
#endif // BOOST_MP_IS_BACKEND_HPP
|
||||
|
||||
@@ -7,30 +7,45 @@
|
||||
#define BOOST_IS_BYTE_CONTAINER_HPP
|
||||
|
||||
#include <iterator>
|
||||
#include <boost/mpl/has_xxx.hpp>
|
||||
#include <boost/type_traits/is_integral.hpp>
|
||||
#include <boost/type_traits/remove_cv.hpp>
|
||||
#include <type_traits>
|
||||
|
||||
namespace boost{ namespace multiprecision{ namespace detail{
|
||||
namespace boost { namespace multiprecision { namespace detail {
|
||||
|
||||
BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(has_member_const_iterator, const_iterator, false)
|
||||
|
||||
template <class C, bool b>
|
||||
struct is_byte_container_imp
|
||||
{
|
||||
// Note: Don't use C::value_type as this is a rather widespread typedef, even for non-range types
|
||||
typedef typename boost::remove_cv<typename std::iterator_traits<typename C::const_iterator>::value_type>::type container_value_type;
|
||||
static const bool value = boost::is_integral<container_value_type>::value && (sizeof(container_value_type) == 1);
|
||||
};
|
||||
|
||||
template <class C>
|
||||
struct is_byte_container_imp<C, false> : public boost::false_type {};
|
||||
|
||||
template <class C>
|
||||
struct is_byte_container : public is_byte_container_imp<C, has_member_const_iterator<C>::value> {};
|
||||
template <class T>
|
||||
struct has_member_const_iterator
|
||||
{
|
||||
template <class U>
|
||||
static double check(U*, typename U::const_iterator* = nullptr);
|
||||
static char check(...);
|
||||
static T* get();
|
||||
static constexpr bool value = sizeof(check(get())) == sizeof(double);
|
||||
};
|
||||
|
||||
|
||||
}}} // namespaces
|
||||
template <class C, class Iterator>
|
||||
struct is_byte_container_imp_2
|
||||
{
|
||||
using container_value_type = typename std::remove_cv<typename std::iterator_traits<typename C::const_iterator>::value_type>::type;
|
||||
static constexpr bool value = boost::multiprecision::detail::is_integral<container_value_type>::value && (sizeof(container_value_type) == 1);
|
||||
};
|
||||
|
||||
template <class C>
|
||||
struct is_byte_container_imp_2<C, void> : public std::false_type
|
||||
{};
|
||||
|
||||
template <class C, bool b>
|
||||
struct is_byte_container_imp : public is_byte_container_imp_2<C, typename C::const_iterator>
|
||||
{
|
||||
};
|
||||
|
||||
template <class C>
|
||||
struct is_byte_container_imp<C, false> : public std::false_type
|
||||
{};
|
||||
|
||||
template <class C>
|
||||
struct is_byte_container : public is_byte_container_imp<C, has_member_const_iterator<C>::value>
|
||||
{};
|
||||
|
||||
}}} // namespace boost::multiprecision::detail
|
||||
|
||||
#endif // BOOST_IS_BYTE_CONTAINER_HPP
|
||||
|
||||
|
||||
22
linx64/include/boost/multiprecision/traits/is_complex.hpp
Normal file
22
linx64/include/boost/multiprecision/traits/is_complex.hpp
Normal file
@@ -0,0 +1,22 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright 2018 John Maddock. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_MP_IS_COMPLEX_HPP
|
||||
#define BOOST_MP_IS_COMPLEX_HPP
|
||||
|
||||
#include <type_traits>
|
||||
#include <complex>
|
||||
|
||||
namespace boost { namespace multiprecision { namespace detail {
|
||||
|
||||
template <class T> struct is_complex : public std::integral_constant<bool, false> {};
|
||||
|
||||
template <class T> struct is_complex<std::complex<T> > : public std::integral_constant<bool, true> {};
|
||||
|
||||
}
|
||||
}
|
||||
} // namespace boost::multiprecision::detail
|
||||
|
||||
#endif // BOOST_MP_IS_BACKEND_HPP
|
||||
@@ -0,0 +1,51 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright 2021 John Maddock. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_IS_CONVERTIBLE_ARITHMETIC_HPP
|
||||
#define BOOST_IS_CONVERTIBLE_ARITHMETIC_HPP
|
||||
|
||||
#include <type_traits>
|
||||
#include <boost/multiprecision/detail/number_base.hpp>
|
||||
#include <boost/multiprecision/detail/standalone_config.hpp>
|
||||
|
||||
namespace boost { namespace multiprecision { namespace detail {
|
||||
|
||||
template <class V, class Backend>
|
||||
struct is_convertible_arithmetic
|
||||
{
|
||||
static constexpr bool value = boost::multiprecision::detail::is_arithmetic<V>::value;
|
||||
};
|
||||
//
|
||||
// For extension types, we don't *require* interoperability,
|
||||
// so only enable it if we can convert the type to the backend
|
||||
// losslessly, ie not via conversion to a narrower type.
|
||||
// Note that backends with templated constructors/=operators
|
||||
// will not be selected here, so these need to either specialize
|
||||
// this trait, or provide a proper non-template constructor/=operator
|
||||
// for the extension types it supports.
|
||||
//
|
||||
#ifdef BOOST_HAS_FLOAT128
|
||||
template <class Backend>
|
||||
struct is_convertible_arithmetic<float128_type, Backend>
|
||||
{
|
||||
static constexpr bool value = std::is_assignable<Backend, convertible_to<float128_type>>::value;
|
||||
};
|
||||
#endif
|
||||
#ifdef BOOST_HAS_INT128
|
||||
template <class Backend>
|
||||
struct is_convertible_arithmetic<int128_type, Backend>
|
||||
{
|
||||
static constexpr bool value = std::is_assignable<Backend, convertible_to<int128_type>>::value;
|
||||
};
|
||||
template <class Backend>
|
||||
struct is_convertible_arithmetic<uint128_type, Backend>
|
||||
{
|
||||
static constexpr bool value = std::is_assignable<Backend, convertible_to<uint128_type>>::value;
|
||||
};
|
||||
#endif
|
||||
|
||||
}}} // namespace boost::multiprecision::detail
|
||||
|
||||
#endif // BOOST_IS_BYTE_CONTAINER_HPP
|
||||
@@ -4,45 +4,44 @@
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_MP_RESTRICTED_CONVERSION_HPP
|
||||
#define BOOST_MP_RESTRICTED_CONVERSION_HPP
|
||||
#ifndef BOOST_MP_IS_RESTRICTED_CONVERSION_HPP
|
||||
#define BOOST_MP_IS_RESTRICTED_CONVERSION_HPP
|
||||
|
||||
#include <boost/multiprecision/traits/explicit_conversion.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/multiprecision/detail/number_base.hpp>
|
||||
|
||||
namespace boost{ namespace multiprecision{ namespace detail{
|
||||
|
||||
namespace boost { namespace multiprecision { namespace detail {
|
||||
|
||||
template <class From, class To>
|
||||
struct is_lossy_conversion
|
||||
{
|
||||
typedef typename mpl::if_c<
|
||||
((number_category<From>::value == number_kind_floating_point) && (number_category<To>::value == number_kind_integer))
|
||||
/* || ((number_category<From>::value == number_kind_floating_point) && (number_category<To>::value == number_kind_rational))*/
|
||||
|| ((number_category<From>::value == number_kind_rational) && (number_category<To>::value == number_kind_integer))
|
||||
|| ((number_category<From>::value == number_kind_fixed_point) && (number_category<To>::value == number_kind_integer))
|
||||
|| (number_category<From>::value == number_kind_unknown)
|
||||
|| (number_category<To>::value == number_kind_unknown),
|
||||
mpl::true_,
|
||||
mpl::false_
|
||||
>::type type;
|
||||
static const bool value = type::value;
|
||||
static constexpr bool category_conditional_is_true =
|
||||
( (static_cast<boost::multiprecision::number_category_type>(number_category<From>::value) == number_kind_floating_point)
|
||||
&& (static_cast<boost::multiprecision::number_category_type>(number_category<To >::value) == number_kind_integer))
|
||||
|| ( (static_cast<boost::multiprecision::number_category_type>(number_category<From>::value) == number_kind_rational)
|
||||
&& (static_cast<boost::multiprecision::number_category_type>(number_category<To >::value) == number_kind_integer))
|
||||
|| ( (static_cast<boost::multiprecision::number_category_type>(number_category<From>::value) == number_kind_fixed_point)
|
||||
&& (static_cast<boost::multiprecision::number_category_type>(number_category<To >::value) == number_kind_integer))
|
||||
|| (static_cast<boost::multiprecision::number_category_type>(number_category<From>::value) == number_kind_unknown)
|
||||
|| (static_cast<boost::multiprecision::number_category_type>(number_category<To >::value) == number_kind_unknown);
|
||||
|
||||
using type = typename std::conditional<category_conditional_is_true,
|
||||
std::integral_constant<bool, true>,
|
||||
std::integral_constant<bool, false>>::type;
|
||||
|
||||
static constexpr bool value = type::value;
|
||||
};
|
||||
|
||||
template<typename From, typename To>
|
||||
template <typename From, typename To>
|
||||
struct is_restricted_conversion
|
||||
{
|
||||
typedef typename mpl::if_c<
|
||||
((is_explicitly_convertible<From, To>::value && !is_convertible<From, To>::value)
|
||||
|| is_lossy_conversion<From, To>::value),
|
||||
mpl::true_,
|
||||
mpl::false_
|
||||
>::type type;
|
||||
static const bool value = type::value;
|
||||
using type = typename std::conditional<
|
||||
((is_explicitly_convertible<From, To>::value && !std::is_convertible<From, To>::value) || is_lossy_conversion<From, To>::value),
|
||||
std::integral_constant<bool, true>,
|
||||
std::integral_constant<bool, false>>::type;
|
||||
static constexpr const bool value = type::value;
|
||||
};
|
||||
|
||||
}}} // namespaces
|
||||
|
||||
#endif // BOOST_MP_RESTRICTED_CONVERSION_HPP
|
||||
}}} // namespace boost::multiprecision::detail
|
||||
|
||||
#endif // BOOST_MP_IS_RESTRICTED_CONVERSION_HPP
|
||||
|
||||
@@ -6,19 +6,20 @@
|
||||
#ifndef BOOST_MP_IS_VARIABLE_PRECISION_HPP
|
||||
#define BOOST_MP_IS_VARIABLE_PRECISION_HPP
|
||||
|
||||
#include <boost/type_traits/integral_constant.hpp>
|
||||
#include <boost/multiprecision/detail/number_base.hpp>
|
||||
|
||||
namespace boost{ namespace multiprecision{ namespace detail{
|
||||
namespace boost { namespace multiprecision { namespace detail {
|
||||
|
||||
template <class Backend>
|
||||
struct is_variable_precision : public false_type{};
|
||||
template <class Backend>
|
||||
struct is_variable_precision : public std::integral_constant<bool, false>
|
||||
{};
|
||||
|
||||
template <class Backend, expression_template_option ExpressionTemplates>
|
||||
struct is_variable_precision<number<Backend, ExpressionTemplates> > : public is_variable_precision<Backend> {};
|
||||
template <class Backend, expression_template_option ExpressionTemplates>
|
||||
struct is_variable_precision<number<Backend, ExpressionTemplates> > : public is_variable_precision<Backend>
|
||||
{};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace boost::multiprecision::detail
|
||||
|
||||
#endif // BOOST_MP_IS_BACKEND_HPP
|
||||
|
||||
79
linx64/include/boost/multiprecision/traits/max_digits10.hpp
Normal file
79
linx64/include/boost/multiprecision/traits/max_digits10.hpp
Normal file
@@ -0,0 +1,79 @@
|
||||
///////////////////////////////////////////////////////////////
|
||||
// Copyright 2012 John Maddock. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#ifndef BOOST_MP_MAX_DIGITS10_HPP
|
||||
#define BOOST_MP_MAX_DIGITS10_HPP
|
||||
|
||||
namespace boost {
|
||||
namespace multiprecision {
|
||||
namespace detail {
|
||||
|
||||
template <unsigned digits>
|
||||
struct calc_max_digits10
|
||||
{
|
||||
static constexpr unsigned max_digits_10(unsigned d)
|
||||
{
|
||||
//
|
||||
// We need ceil(log10(2) * d) + 1 decimal places to
|
||||
// guarantee round tripping, see: https://www.exploringbinary.com/number-of-digits-required-for-round-trip-conversions/
|
||||
// and references therein. Since log10(2) is irrational, then d*log10(2) will
|
||||
// never be exactly an integer so we can replace by trunc(log10(2) * d) + 2
|
||||
// and avoid the call to ceil:
|
||||
//
|
||||
return static_cast<unsigned>(0.301029995663981195213738894724493026768189881462108541310 * d) + 2;
|
||||
}
|
||||
static constexpr unsigned value = max_digits_10(digits);
|
||||
};
|
||||
|
||||
template <std::size_t digits>
|
||||
struct calc_max_digits10_s
|
||||
{
|
||||
static constexpr std::size_t max_digits_10(std::size_t d)
|
||||
{
|
||||
//
|
||||
// We need ceil(log10(2) * d) + 1 decimal places to
|
||||
// guarantee round tripping, see: https://www.exploringbinary.com/number-of-digits-required-for-round-trip-conversions/
|
||||
// and references therein. Since log10(2) is irrational, then d*log10(2) will
|
||||
// never be exactly an integer so we can replace by trunc(log10(2) * d) + 2
|
||||
// and avoid the call to ceil:
|
||||
//
|
||||
return static_cast<std::size_t>(static_cast<std::size_t>(0.301029995663981195213738894724493026768189881462108541310 * static_cast<double>(d)) + 2u);
|
||||
}
|
||||
static constexpr std::size_t value = max_digits_10(digits);
|
||||
};
|
||||
|
||||
template <unsigned digits>
|
||||
struct calc_digits10
|
||||
{
|
||||
static constexpr unsigned digits_10(unsigned d)
|
||||
{
|
||||
//
|
||||
// We need floor(log10(2) * (d-1)), see:
|
||||
// https://www.exploringbinary.com/number-of-digits-required-for-round-trip-conversions/
|
||||
// and references therein.
|
||||
//
|
||||
return static_cast<unsigned>(0.301029995663981195213738894724493026768189881462108541310 * static_cast<double>(d - 1u));
|
||||
}
|
||||
static constexpr unsigned value = digits_10(digits);
|
||||
};
|
||||
|
||||
template <std::size_t digits>
|
||||
struct calc_digits10_s
|
||||
{
|
||||
static constexpr std::size_t digits_10(std::size_t d)
|
||||
{
|
||||
//
|
||||
// We need floor(log10(2) * (d-1)), see:
|
||||
// https://www.exploringbinary.com/number-of-digits-required-for-round-trip-conversions/
|
||||
// and references therein.
|
||||
//
|
||||
return static_cast<std::size_t>(0.301029995663981195213738894724493026768189881462108541310 * static_cast<double>(d - 1u));
|
||||
}
|
||||
static constexpr std::size_t value = digits_10(digits);
|
||||
};
|
||||
|
||||
}}} // namespace boost::multiprecision::detail
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,90 @@
|
||||
///////////////////////////////////////////////////////////////
|
||||
// Copyright 2012-2022 John Maddock.
|
||||
// Copyright 2022 Matt Borland. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#ifndef BOOST_MP_STD_INTEGER_TRAITS_HPP
|
||||
#define BOOST_MP_STD_INTEGER_TRAITS_HPP
|
||||
|
||||
#include <type_traits>
|
||||
#include <boost/multiprecision/detail/standalone_config.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace multiprecision {
|
||||
namespace detail {
|
||||
|
||||
template <class T>
|
||||
struct is_signed : public std::is_signed<T> {};
|
||||
template <class T>
|
||||
struct is_unsigned : public std::is_unsigned<T> {};
|
||||
template <class T>
|
||||
struct is_integral : public std::is_integral<T> {};
|
||||
template <class T>
|
||||
struct is_arithmetic : public std::is_arithmetic<T> {};
|
||||
template <class T>
|
||||
struct make_unsigned : public std::make_unsigned<T> {};
|
||||
template <class T>
|
||||
struct make_signed : public std::make_signed<T> {};
|
||||
|
||||
#ifdef BOOST_HAS_INT128
|
||||
|
||||
template <>
|
||||
struct is_signed<int128_type> : public std::true_type {};
|
||||
template <>
|
||||
struct is_signed<uint128_type> : public std::false_type {};
|
||||
template <>
|
||||
struct is_unsigned<int128_type> : public std::false_type {};
|
||||
template <>
|
||||
struct is_unsigned<uint128_type> : public std::true_type {};
|
||||
template <>
|
||||
struct is_integral<int128_type> : public std::true_type {};
|
||||
template <>
|
||||
struct is_integral<uint128_type> : public std::true_type {};
|
||||
template <>
|
||||
struct is_arithmetic<int128_type> : public std::true_type {};
|
||||
template <>
|
||||
struct is_arithmetic<uint128_type> : public std::true_type {};
|
||||
template <>
|
||||
struct make_unsigned<int128_type>
|
||||
{
|
||||
using type = uint128_type;
|
||||
};
|
||||
template <>
|
||||
struct make_unsigned<uint128_type>
|
||||
{
|
||||
using type = uint128_type;
|
||||
};
|
||||
template <>
|
||||
struct make_signed<int128_type>
|
||||
{
|
||||
using type = int128_type;
|
||||
};
|
||||
template <>
|
||||
struct make_signed<uint128_type>
|
||||
{
|
||||
using type = int128_type;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
// C++17-esque helpers
|
||||
#if defined(__cpp_variable_templates) && __cpp_variable_templates >= 201304L
|
||||
template <typename T>
|
||||
BOOST_INLINE_CONSTEXPR bool is_signed_v = is_signed<T>::value;
|
||||
template <typename T>
|
||||
BOOST_INLINE_CONSTEXPR bool is_unsigned_v = is_unsigned<T>::value;
|
||||
template <typename T>
|
||||
BOOST_INLINE_CONSTEXPR bool is_integral_v = is_integral<T>::value;
|
||||
template <typename T>
|
||||
BOOST_INLINE_CONSTEXPR bool is_arithmetic_v = is_arithmetic<T>::value;
|
||||
#endif
|
||||
|
||||
template <typename T>
|
||||
using make_unsigned_t = typename make_unsigned<T>::type;
|
||||
template <typename T>
|
||||
using make_signed_t = typename make_signed<T>::type;
|
||||
|
||||
}}} // namespace boost::multiprecision::detail
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,21 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright 2020 John Maddock. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_MP_TRANSCENDENTAL_REDUCTION_TYPE_HPP
|
||||
#define BOOST_MP_TRANSCENDENTAL_REDUCTION_TYPE_HPP
|
||||
|
||||
namespace boost { namespace multiprecision { namespace detail {
|
||||
|
||||
template <class T>
|
||||
struct transcendental_reduction_type
|
||||
{
|
||||
using type = T;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
} // namespace boost::multiprecision::detail
|
||||
|
||||
#endif // BOOST_MP_TRANSCENDENTAL_REDUCTION_TYPE_HPP
|
||||
Reference in New Issue
Block a user