fix math implementation.

This commit is contained in:
bolero-MURAKAMI 2012-06-23 13:22:50 +09:00
parent 3500d0d49c
commit 1636398742
49 changed files with 227 additions and 456 deletions

View file

@ -7,7 +7,7 @@
#include <sprout/algorithm/fixed/partition_copy.hpp>
#include <sprout/algorithm/fit/result_of.hpp>
#include <sprout/sub_array.hpp>
#include <sprout/detail/algorithm_ext.hpp>
#include <sprout/detail/count_n_if.hpp>
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT
#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT

View file

@ -7,7 +7,7 @@
#include <sprout/algorithm/fixed/set_difference.hpp>
#include <sprout/algorithm/fit/result_of.hpp>
#include <sprout/sub_array.hpp>
#include <sprout/detail/overlap_count_2.hpp>
#include <sprout/detail/set_overlap_count.hpp>
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT
#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT
@ -30,7 +30,7 @@ namespace sprout {
offset,
offset + NS_SSCRISK_CEL_OR_SPROUT::min(
NS_SSCRISK_CEL_OR_SPROUT::distance(first1, last1)
- sprout::detail::overlap_count_2(first1, last1, first2, last2, comp)
- sprout::detail::set_overlap_count(first1, last1, first2, last2, comp)
,
sprout::size(result)
)
@ -69,7 +69,7 @@ namespace sprout {
offset,
offset + NS_SSCRISK_CEL_OR_SPROUT::min(
NS_SSCRISK_CEL_OR_SPROUT::distance(first1, last1)
- sprout::detail::overlap_count_2(first1, last1, first2, last2)
- sprout::detail::set_overlap_count(first1, last1, first2, last2)
,
sprout::size(result)
)

View file

@ -7,7 +7,7 @@
#include <sprout/algorithm/fixed/set_intersection.hpp>
#include <sprout/algorithm/fit/result_of.hpp>
#include <sprout/sub_array.hpp>
#include <sprout/detail/overlap_count_2.hpp>
#include <sprout/detail/set_overlap_count.hpp>
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT
namespace sprout {
@ -28,7 +28,7 @@ namespace sprout {
sprout::get_internal(sprout::fixed::set_intersection(first1, last1, first2, last2, result, comp)),
offset,
offset + NS_SSCRISK_CEL_OR_SPROUT::min(
sprout::detail::overlap_count_2(first1, last1, first2, last2, comp),
sprout::detail::set_overlap_count(first1, last1, first2, last2, comp),
sprout::size(result)
)
);
@ -65,7 +65,7 @@ namespace sprout {
sprout::get_internal(sprout::fixed::set_intersection(first1, last1, first2, last2, result)),
offset,
offset + NS_SSCRISK_CEL_OR_SPROUT::min(
sprout::detail::overlap_count_2(first1, last1, first2, last2),
sprout::detail::set_overlap_count(first1, last1, first2, last2),
sprout::size(result)
)
);

View file

@ -7,7 +7,7 @@
#include <sprout/algorithm/fixed/set_symmetric_difference.hpp>
#include <sprout/algorithm/fit/result_of.hpp>
#include <sprout/sub_array.hpp>
#include <sprout/detail/overlap_count_2.hpp>
#include <sprout/detail/set_overlap_count.hpp>
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT
#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT
@ -31,7 +31,7 @@ namespace sprout {
offset + NS_SSCRISK_CEL_OR_SPROUT::min(
NS_SSCRISK_CEL_OR_SPROUT::distance(first1, last1)
+ NS_SSCRISK_CEL_OR_SPROUT::distance(first2, last2)
- 2 * sprout::detail::overlap_count_2(first1, last1, first2, last2, comp)
- 2 * sprout::detail::set_overlap_count(first1, last1, first2, last2, comp)
,
sprout::size(result)
)
@ -71,7 +71,7 @@ namespace sprout {
offset + NS_SSCRISK_CEL_OR_SPROUT::min(
NS_SSCRISK_CEL_OR_SPROUT::distance(first1, last1)
+ NS_SSCRISK_CEL_OR_SPROUT::distance(first2, last2)
- 2 * sprout::detail::overlap_count_2(first1, last1, first2, last2)
- 2 * sprout::detail::set_overlap_count(first1, last1, first2, last2)
,
sprout::size(result)
)

View file

@ -7,7 +7,7 @@
#include <sprout/algorithm/fixed/set_union.hpp>
#include <sprout/algorithm/fit/result_of.hpp>
#include <sprout/sub_array.hpp>
#include <sprout/detail/overlap_count_2.hpp>
#include <sprout/detail/set_overlap_count.hpp>
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT
#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT
@ -31,7 +31,7 @@ namespace sprout {
offset + NS_SSCRISK_CEL_OR_SPROUT::min(
NS_SSCRISK_CEL_OR_SPROUT::distance(first1, last1)
+ NS_SSCRISK_CEL_OR_SPROUT::distance(first2, last2)
- sprout::detail::overlap_count_2(first1, last1, first2, last2, comp)
- sprout::detail::set_overlap_count(first1, last1, first2, last2, comp)
,
sprout::size(result)
)
@ -71,7 +71,7 @@ namespace sprout {
offset + NS_SSCRISK_CEL_OR_SPROUT::min(
NS_SSCRISK_CEL_OR_SPROUT::distance(first1, last1)
+ NS_SSCRISK_CEL_OR_SPROUT::distance(first2, last2)
- sprout::detail::overlap_count_2(first1, last1, first2, last2)
- sprout::detail::set_overlap_count(first1, last1, first2, last2)
,
sprout::size(result)
)

View file

@ -1,44 +0,0 @@
#ifndef SPROUT_DETAIL_ALGORITHM_EXT_HPP
#define SPROUT_DETAIL_ALGORITHM_EXT_HPP
#include <iterator>
#include <sprout/config.hpp>
#include <sprout/iterator/operation.hpp>
namespace sprout {
namespace detail {
//
// count_n
//
template<typename InputIterator, typename Size, typename T>
SPROUT_CONSTEXPR typename std::iterator_traits<InputIterator>::difference_type count_n(
InputIterator first,
Size n,
T const& value
)
{
return n == 0
? 0
: (*first == value ? 1 : 0) + sprout::detail::count_n(sprout::next(first), n - 1, value)
;
}
//
// count_n_if
//
template<typename InputIterator, typename Size, typename Predicate>
SPROUT_CONSTEXPR typename std::iterator_traits<InputIterator>::difference_type count_n_if(
InputIterator first,
Size n,
Predicate pred
)
{
return n == 0
? 0
: (pred(*first) ? 1 : 0) + sprout::detail::count_n_if(sprout::next(first), n - 1, pred)
;
}
} // namespace detail
} // namespace sprout
#endif // #ifndef SPROUT_DETAIL_ALGORITHM_EXT_HPP

27
sprout/detail/count_n.hpp Normal file
View file

@ -0,0 +1,27 @@
#ifndef SPROUT_DETAIL_COUNT_N_HPP
#define SPROUT_DETAIL_COUNT_N_HPP
#include <iterator>
#include <sprout/config.hpp>
#include <sprout/iterator/operation.hpp>
namespace sprout {
namespace detail {
//
// count_n
//
template<typename InputIterator, typename Size, typename T>
SPROUT_CONSTEXPR typename std::iterator_traits<InputIterator>::difference_type count_n(
InputIterator first,
Size n,
T const& value
)
{
return n == 0 ? 0
: (*first == value ? 1 : 0) + sprout::detail::count_n(sprout::next(first), n - 1, value)
;
}
} // namespace detail
} // namespace sprout
#endif // #ifndef SPROUT_DETAIL_COUNT_N_HPP

View file

@ -0,0 +1,27 @@
#ifndef SPROUT_DETAIL_COUNT_N_IF_HPP
#define SPROUT_DETAIL_COUNT_N_IF_HPP
#include <iterator>
#include <sprout/config.hpp>
#include <sprout/iterator/operation.hpp>
namespace sprout {
namespace detail {
//
// count_n_if
//
template<typename InputIterator, typename Size, typename Predicate>
SPROUT_CONSTEXPR typename std::iterator_traits<InputIterator>::difference_type count_n_if(
InputIterator first,
Size n,
Predicate pred
)
{
return n == 0 ? 0
: (pred(*first) ? 1 : 0) + sprout::detail::count_n_if(sprout::next(first), n - 1, pred)
;
}
} // namespace detail
} // namespace sprout
#endif // #ifndef SPROUT_DETAIL_COUNT_N_IF_HPP

View file

@ -1,40 +0,0 @@
#ifndef SPROUT_DETAIL_ITERATOR_EXT_HPP
#define SPROUT_DETAIL_ITERATOR_EXT_HPP
#include <iterator>
#include <sprout/config.hpp>
#include <sprout/iterator/operation.hpp>
namespace sprout {
namespace detail {
template<typename Iterator>
SPROUT_CONSTEXPR typename std::iterator_traits<Iterator>::difference_type bidirectional_distance_impl(
Iterator first1,
Iterator first2,
Iterator last,
typename std::iterator_traits<Iterator>::difference_type current = 1
)
{
return first1 == last ? current
: first2 == last ? -current
: sprout::detail::bidirectional_distance_impl(sprout::next(first1), sprout::prev(first2), last, current + 1)
;
}
//
// bidirectional_distance
//
template<typename Iterator>
SPROUT_CONSTEXPR typename std::iterator_traits<Iterator>::difference_type bidirectional_distance(
Iterator first,
Iterator last
)
{
return first == last ? 0
: sprout::detail::bidirectional_distance_impl(sprout::next(first), sprout::prev(first), last)
;
}
} // namespace detail
} // namespace sprout
#endif // #ifndef SPROUT_DETAIL_ITERATOR_EXT_HPP

View file

@ -7,12 +7,12 @@
namespace sprout {
namespace detail {
template<typename Iterator>
inline SPROUT_CONSTEXPR typename std::iterator_traits<Iterator>::difference_type overlap_count_impl(
Iterator first,
Iterator last,
typename std::iterator_traits<Iterator>::value_type const& value,
typename std::iterator_traits<Iterator>::difference_type current = 0
template<typename InputIterator>
inline SPROUT_CONSTEXPR typename std::iterator_traits<InputIterator>::difference_type overlap_count_impl(
InputIterator first,
InputIterator last,
typename std::iterator_traits<InputIterator>::value_type const& value,
typename std::iterator_traits<InputIterator>::difference_type current = 0
)
{
return first == last
@ -25,10 +25,10 @@ namespace sprout {
//
// overlap_count
//
template<typename Iterator>
inline SPROUT_CONSTEXPR typename std::iterator_traits<Iterator>::difference_type overlap_count(
Iterator first,
Iterator last
template<typename InputIterator>
inline SPROUT_CONSTEXPR typename std::iterator_traits<InputIterator>::difference_type overlap_count(
InputIterator first,
InputIterator last
)
{
return first == last
@ -37,12 +37,12 @@ namespace sprout {
;
}
template<typename Iterator, typename Predicate>
inline SPROUT_CONSTEXPR typename std::iterator_traits<Iterator>::difference_type overlap_count_impl(
Iterator first,
Iterator last,
template<typename InputIterator, typename Predicate>
inline SPROUT_CONSTEXPR typename std::iterator_traits<InputIterator>::difference_type overlap_count_impl(
InputIterator first,
InputIterator last,
Predicate pred,
typename std::iterator_traits<Iterator>::value_type const& value
typename std::iterator_traits<InputIterator>::value_type const& value
)
{
return first == last
@ -55,10 +55,10 @@ namespace sprout {
//
// overlap_count
//
template<typename Iterator, typename Predicate>
inline SPROUT_CONSTEXPR typename std::iterator_traits<Iterator>::difference_type overlap_count(
Iterator first,
Iterator last,
template<typename InputIterator, typename Predicate>
inline SPROUT_CONSTEXPR typename std::iterator_traits<InputIterator>::difference_type overlap_count(
InputIterator first,
InputIterator last,
Predicate pred
)
{

View file

@ -1,54 +0,0 @@
#ifndef SPROUT_DETAIL_OVERLAP_COUNT_2_HPP
#define SPROUT_DETAIL_OVERLAP_COUNT_2_HPP
#include <iterator>
#include <sprout/config.hpp>
#include <sprout/iterator/operation.hpp>
namespace sprout {
namespace detail {
//
// overlap_count_2
//
template<typename Iterator1, typename Iterator2, typename Compare>
inline SPROUT_CONSTEXPR typename std::iterator_traits<Iterator1>::difference_type overlap_count_2(
Iterator1 first1,
Iterator1 last1,
Iterator2 first2,
Iterator2 last2,
Compare comp
)
{
return first1 != last1 && first2 != last2
? comp(*first1, *first2)
? sprout::detail::overlap_count_2(sprout::next(first1), last1, first2, last2, comp)
: comp(*first2, *first1)
? sprout::detail::overlap_count_2(first1, last1, sprout::next(first2), last2, comp)
: 1 + sprout::detail::overlap_count_2(sprout::next(first1), last1, sprout::next(first2), last2, comp)
: 0
;
}
//
// overlap_count_2
//
template<typename Iterator1, typename Iterator2>
inline SPROUT_CONSTEXPR typename std::iterator_traits<Iterator1>::difference_type overlap_count_2(
Iterator1 first1,
Iterator1 last1,
Iterator2 first2,
Iterator2 last2
)
{
return first1 != last1 && first2 != last2
? *first1 < *first2
? sprout::detail::overlap_count_2(sprout::next(first1), last1, first2, last2)
: *first2 < *first1
? sprout::detail::overlap_count_2(first1, last1, sprout::next(first2), last2)
: 1 + sprout::detail::overlap_count_2(sprout::next(first1), last1, sprout::next(first2), last2)
: 0
;
}
} // namespace detail
} // namespace sprout
#endif // #ifndef SPROUT_DETAIL_OVERLAP_COUNT_2_HPP

View file

@ -0,0 +1,54 @@
#ifndef SPROUT_DETAIL_SET_OVERLAP_COUNT_HPP
#define SPROUT_DETAIL_SET_OVERLAP_COUNT_HPP
#include <iterator>
#include <sprout/config.hpp>
#include <sprout/iterator/operation.hpp>
namespace sprout {
namespace detail {
//
// set_overlap_count
//
template<typename InputIterator1, typename InputIterator2, typename Compare>
inline SPROUT_CONSTEXPR typename std::iterator_traits<InputIterator1>::difference_type set_overlap_count(
InputIterator1 first1,
InputIterator1 last1,
InputIterator2 first2,
InputIterator2 last2,
Compare comp
)
{
return first1 != last1 && first2 != last2
? comp(*first1, *first2)
? sprout::detail::set_overlap_count(sprout::next(first1), last1, first2, last2, comp)
: comp(*first2, *first1)
? sprout::detail::set_overlap_count(first1, last1, sprout::next(first2), last2, comp)
: 1 + sprout::detail::set_overlap_count(sprout::next(first1), last1, sprout::next(first2), last2, comp)
: 0
;
}
//
// set_overlap_count
//
template<typename InputIterator1, typename InputIterator2>
inline SPROUT_CONSTEXPR typename std::iterator_traits<InputIterator1>::difference_type set_overlap_count(
InputIterator1 first1,
InputIterator1 last1,
InputIterator2 first2,
InputIterator2 last2
)
{
return first1 != last1 && first2 != last2
? *first1 < *first2
? sprout::detail::set_overlap_count(sprout::next(first1), last1, first2, last2)
: *first2 < *first1
? sprout::detail::set_overlap_count(first1, last1, sprout::next(first2), last2)
: 1 + sprout::detail::set_overlap_count(sprout::next(first1), last1, sprout::next(first2), last2)
: 0
;
}
} // namespace detail
} // namespace sprout
#endif // #ifndef SPROUT_DETAIL_SET_OVERLAP_COUNT_HPP

View file

@ -4,9 +4,7 @@
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/type_traits/enabler_if.hpp>
#if SPROUT_USE_BUILTIN_CMATH_FUNCTION
# include <cmath>
#endif
#include <sprout/math/detail/config.hpp>
namespace sprout {
namespace math {
@ -27,12 +25,7 @@ namespace sprout {
>
inline SPROUT_CONSTEXPR FloatType
abs(FloatType x) {
# if SPROUT_USE_BUILTIN_CMATH_FUNCTION
using std::abs;
# else
using sprout::math::detail::abs;
# endif
return abs(x);
return NS_SPROUT_MATH_DETAIL::abs(x);
}
} // namespace math

View file

@ -3,12 +3,10 @@
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/math/detail/config.hpp>
#include <sprout/math/asin.hpp>
#include <sprout/math/constants.hpp>
#include <sprout/type_traits/enabler_if.hpp>
#if SPROUT_USE_BUILTIN_CMATH_FUNCTION
# include <cmath>
#endif
namespace sprout {
namespace math {
@ -32,11 +30,7 @@ namespace sprout {
}
} // namespace detail
# if SPROUT_USE_BUILTIN_CMATH_FUNCTION
using std::acos;
# else
using sprout::math::detail::acos;
# endif
using NS_SPROUT_MATH_DETAIL::acos;
} // namespace math
using sprout::math::acos;

View file

@ -4,12 +4,10 @@
#include <limits>
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/math/detail/config.hpp>
#include <sprout/math/log.hpp>
#include <sprout/math/sqrt.hpp>
#include <sprout/type_traits/enabler_if.hpp>
#if SPROUT_USE_BUILTIN_CMATH_FUNCTION
# include <cmath>
#endif
namespace sprout {
namespace math {
@ -36,11 +34,7 @@ namespace sprout {
}
} // namespace detail
# if SPROUT_USE_BUILTIN_CMATH_FUNCTION
using std::acosh;
# else
using sprout::math::detail::acosh;
# endif
using NS_SPROUT_MATH_DETAIL::acosh;
} // namespace math
using sprout::math::acosh;

View file

@ -5,13 +5,11 @@
#include <limits>
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/math/detail/config.hpp>
#include <sprout/math/constants.hpp>
#include <sprout/math/factorial.hpp>
#include <sprout/math/sqrt.hpp>
#include <sprout/type_traits/enabler_if.hpp>
#if SPROUT_USE_BUILTIN_CMATH_FUNCTION
# include <cmath>
#endif
namespace sprout {
namespace math {
@ -75,11 +73,7 @@ namespace sprout {
}
} // namespace detail
# if SPROUT_USE_BUILTIN_CMATH_FUNCTION
using std::asin;
# else
using sprout::math::detail::asin;
# endif
using NS_SPROUT_MATH_DETAIL::asin;
} // namespace math
using sprout::math::asin;

View file

@ -4,12 +4,10 @@
#include <limits>
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/math/detail/config.hpp>
#include <sprout/math/log.hpp>
#include <sprout/math/sqrt.hpp>
#include <sprout/type_traits/enabler_if.hpp>
#if SPROUT_USE_BUILTIN_CMATH_FUNCTION
# include <cmath>
#endif
namespace sprout {
namespace math {
@ -36,11 +34,7 @@ namespace sprout {
}
} // namespace detail
# if SPROUT_USE_BUILTIN_CMATH_FUNCTION
using std::asinh;
# else
using sprout::math::detail::asinh;
# endif
using NS_SPROUT_MATH_DETAIL::asinh;
} // namespace math
using sprout::math::asinh;

View file

@ -4,12 +4,10 @@
#include <cstddef>
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/math/detail/config.hpp>
#include <sprout/math/constants.hpp>
#include <sprout/math/factorial.hpp>
#include <sprout/type_traits/enabler_if.hpp>
#if SPROUT_USE_BUILTIN_CMATH_FUNCTION
# include <cmath>
#endif
namespace sprout {
namespace math {
@ -70,11 +68,7 @@ namespace sprout {
}
} // namespace detail
# if SPROUT_USE_BUILTIN_CMATH_FUNCTION
using std::atan;
# else
using sprout::math::detail::atan;
# endif
using NS_SPROUT_MATH_DETAIL::atan;
} // namespace math
using sprout::math::atan;

View file

@ -3,13 +3,11 @@
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/math/detail/config.hpp>
#include <sprout/math/atan.hpp>
#include <sprout/math/constants.hpp>
#include <sprout/math/float_promote.hpp>
#include <sprout/type_traits/enabler_if.hpp>
#if SPROUT_USE_BUILTIN_CMATH_FUNCTION
# include <cmath>
#endif
namespace sprout {
namespace math {
@ -40,11 +38,7 @@ namespace sprout {
}
} // namespace detail
# if SPROUT_USE_BUILTIN_CMATH_FUNCTION
using std::atan2;
# else
using sprout::math::detail::atan2;
# endif
using NS_SPROUT_MATH_DETAIL::atan2;
} // namespace math
using sprout::math::atan2;

View file

@ -4,11 +4,9 @@
#include <limits>
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/math/detail/config.hpp>
#include <sprout/math/log.hpp>
#include <sprout/type_traits/enabler_if.hpp>
#if SPROUT_USE_BUILTIN_CMATH_FUNCTION
# include <cmath>
#endif
namespace sprout {
namespace math {
@ -36,11 +34,7 @@ namespace sprout {
}
} // namespace detail
# if SPROUT_USE_BUILTIN_CMATH_FUNCTION
using std::atanh;
# else
using sprout::math::detail::atanh;
# endif
using NS_SPROUT_MATH_DETAIL::atanh;
} // namespace math
using sprout::math::atanh;

View file

@ -3,12 +3,10 @@
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/math/detail/config.hpp>
#include <sprout/math/pow.hpp>
#include <sprout/math/constants.hpp>
#include <sprout/type_traits/enabler_if.hpp>
#if SPROUT_USE_BUILTIN_CMATH_FUNCTION
# include <cmath>
#endif
namespace sprout {
namespace math {
@ -34,11 +32,7 @@ namespace sprout {
}
} // namespace detail
# if SPROUT_USE_BUILTIN_CMATH_FUNCTION
using std::cbrt;
# else
using sprout::math::detail::cbrt;
# endif
using NS_SPROUT_MATH_DETAIL::cbrt;
} // namespace math
using sprout::math::cbrt;

View file

@ -5,11 +5,9 @@
#include <limits>
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/math/detail/config.hpp>
#include <sprout/math/factorial.hpp>
#include <sprout/type_traits/enabler_if.hpp>
#if SPROUT_USE_BUILTIN_CMATH_FUNCTION
# include <cmath>
#endif
namespace sprout {
namespace math {
@ -56,11 +54,7 @@ namespace sprout {
}
} // namespace detail
# if SPROUT_USE_BUILTIN_CMATH_FUNCTION
using std::cos;
# else
using sprout::math::detail::cos;
# endif
using NS_SPROUT_MATH_DETAIL::cos;
} // namespace math
using sprout::math::cos;

View file

@ -4,11 +4,9 @@
#include <cstddef>
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/math/detail/config.hpp>
#include <sprout/math/factorial.hpp>
#include <sprout/type_traits/enabler_if.hpp>
#if SPROUT_USE_BUILTIN_CMATH_FUNCTION
# include <cmath>
#endif
namespace sprout {
namespace math {
@ -51,11 +49,7 @@ namespace sprout {
}
} // namespace detail
# if SPROUT_USE_BUILTIN_CMATH_FUNCTION
using std::cosh;
# else
using sprout::math::detail::cosh;
# endif
using NS_SPROUT_MATH_DETAIL::cosh;
} // namespace math
using sprout::math::cosh;

View file

@ -0,0 +1,15 @@
#ifndef SPROUT_MATH_DETAIL_CONFIG_HPP
#define SPROUT_MATH_DETAIL_CONFIG_HPP
#include <sprout/config.hpp>
#if SPROUT_USE_BUILTIN_CMATH_FUNCTION
# include <cmath>
#endif
#if SPROUT_USE_BUILTIN_CMATH_FUNCTION
# define NS_SPROUT_MATH_DETAIL std
#else // #ifndef SPROUT_USE_BUILTIN_CMATH_FUNCTION
# define NS_SPROUT_MATH_DETAIL sprout::math::detail
#endif // #ifndef SPROUT_USE_BUILTIN_CMATH_FUNCTION
#endif // #ifndef SPROUT_MATH_DETAIL_CONFIG_HPP

View file

@ -4,11 +4,9 @@
#include <cstddef>
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/math/detail/config.hpp>
#include <sprout/math/factorial.hpp>
#include <sprout/type_traits/enabler_if.hpp>
#if SPROUT_USE_BUILTIN_CMATH_FUNCTION
# include <cmath>
#endif
namespace sprout {
namespace math {
@ -51,11 +49,7 @@ namespace sprout {
}
} // namespace detail
# if SPROUT_USE_BUILTIN_CMATH_FUNCTION
using std::exp;
# else
using sprout::math::detail::exp;
# endif
using NS_SPROUT_MATH_DETAIL::exp;
} // namespace math
using sprout::math::exp;

View file

@ -3,12 +3,10 @@
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/math/detail/config.hpp>
#include <sprout/math/exp.hpp>
#include <sprout/math/constants.hpp>
#include <sprout/type_traits/enabler_if.hpp>
#if SPROUT_USE_BUILTIN_CMATH_FUNCTION
# include <cmath>
#endif
namespace sprout {
namespace math {
@ -32,11 +30,7 @@ namespace sprout {
}
} // namespace detail
# if SPROUT_USE_BUILTIN_CMATH_FUNCTION
using std::exp2;
# else
using sprout::math::detail::exp2;
# endif
using NS_SPROUT_MATH_DETAIL::exp2;
} // namespace math
using sprout::math::exp2;

View file

@ -3,12 +3,10 @@
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/math/detail/config.hpp>
#include <sprout/math/exp.hpp>
#include <sprout/math/constants.hpp>
#include <sprout/type_traits/enabler_if.hpp>
#if SPROUT_USE_BUILTIN_CMATH_FUNCTION
# include <cmath>
#endif
namespace sprout {
namespace math {
@ -32,11 +30,7 @@ namespace sprout {
}
} // namespace detail
# if SPROUT_USE_BUILTIN_CMATH_FUNCTION
using std::expm1;
# else
using sprout::math::detail::expm1;
# endif
using NS_SPROUT_MATH_DETAIL::expm1;
} // namespace math
using sprout::math::expm1;

View file

@ -3,10 +3,8 @@
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/math/detail/config.hpp>
#include <sprout/type_traits/enabler_if.hpp>
#if SPROUT_USE_BUILTIN_CMATH_FUNCTION
# include <cmath>
#endif
namespace sprout {
namespace math {
@ -30,11 +28,7 @@ namespace sprout {
}
} // namespace detail
# if SPROUT_USE_BUILTIN_CMATH_FUNCTION
using std::fabs;
# else
using sprout::math::detail::fabs;
# endif
using NS_SPROUT_MATH_DETAIL::fabs;
} // namespace math
using sprout::math::fabs;

View file

@ -3,11 +3,9 @@
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/math/detail/config.hpp>
#include <sprout/math/float_promote.hpp>
#include <sprout/type_traits/enabler_if.hpp>
#if SPROUT_USE_BUILTIN_CMATH_FUNCTION
# include <cmath>
#endif
namespace sprout {
namespace math {
@ -35,11 +33,7 @@ namespace sprout {
}
} // namespace detail
# if SPROUT_USE_BUILTIN_CMATH_FUNCTION
using std::fdim;
# else
using sprout::math::detail::fdim;
# endif
using NS_SPROUT_MATH_DETAIL::fdim;
} // namespace math
using sprout::math::fdim;

View file

@ -3,11 +3,9 @@
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/math/detail/config.hpp>
#include <sprout/math/float_promote.hpp>
#include <sprout/type_traits/enabler_if.hpp>
#if SPROUT_USE_BUILTIN_CMATH_FUNCTION
# include <cmath>
#endif
namespace sprout {
namespace math {
@ -42,11 +40,7 @@ namespace sprout {
}
} // namespace detail
# if SPROUT_USE_BUILTIN_CMATH_FUNCTION
using std::fma;
# else
using sprout::math::detail::fma;
# endif
using NS_SPROUT_MATH_DETAIL::fma;
} // namespace math
using sprout::math::fma;

View file

@ -3,11 +3,9 @@
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/math/detail/config.hpp>
#include <sprout/math/float_promote.hpp>
#include <sprout/type_traits/enabler_if.hpp>
#if SPROUT_USE_BUILTIN_CMATH_FUNCTION
# include <cmath>
#endif
namespace sprout {
namespace math {
@ -35,11 +33,7 @@ namespace sprout {
}
} // namespace detail
# if SPROUT_USE_BUILTIN_CMATH_FUNCTION
using std::fmax;
# else
using sprout::math::detail::fmax;
# endif
using NS_SPROUT_MATH_DETAIL::fmax;
} // namespace math
using sprout::math::fmax;

View file

@ -3,11 +3,9 @@
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/math/detail/config.hpp>
#include <sprout/math/float_promote.hpp>
#include <sprout/type_traits/enabler_if.hpp>
#if SPROUT_USE_BUILTIN_CMATH_FUNCTION
# include <cmath>
#endif
namespace sprout {
namespace math {
@ -35,11 +33,7 @@ namespace sprout {
}
} // namespace detail
# if SPROUT_USE_BUILTIN_CMATH_FUNCTION
using std::fmin;
# else
using sprout::math::detail::fmin;
# endif
using NS_SPROUT_MATH_DETAIL::fmin;
} // namespace math
using sprout::math::fmin;

View file

@ -5,6 +5,7 @@
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/type_traits/enabler_if.hpp>
#include <sprout/math/detail/config.hpp>
#include <sprout/math/isnan.hpp>
#include <sprout/math/isinf.hpp>
#include <sprout/math/iszero.hpp>
@ -28,11 +29,7 @@ namespace sprout {
}
} // namespace detail
# if SPROUT_USE_BUILTIN_CMATH_FUNCTION
using std::fpclassify;
# else
using sprout::math::detail::fpclassify;
# endif
using NS_SPROUT_MATH_DETAIL::fpclassify;
} // namespace math
using sprout::math::fpclassify;

View file

@ -3,12 +3,10 @@
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/math/detail/config.hpp>
#include <sprout/math/float_promote.hpp>
#include <sprout/math/sqrt.hpp>
#include <sprout/type_traits/enabler_if.hpp>
#if SPROUT_USE_BUILTIN_CMATH_FUNCTION
# include <cmath>
#endif
namespace sprout {
namespace math {
@ -36,11 +34,7 @@ namespace sprout {
}
} // namespace detail
# if SPROUT_USE_BUILTIN_CMATH_FUNCTION
using std::hypot;
# else
using sprout::math::detail::hypot;
# endif
using NS_SPROUT_MATH_DETAIL::hypot;
} // namespace math
using sprout::math::hypot;

View file

@ -4,11 +4,9 @@
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/type_traits/enabler_if.hpp>
#include <sprout/math/detail/config.hpp>
#include <sprout/math/isnan.hpp>
#include <sprout/math/isinf.hpp>
#if SPROUT_USE_BUILTIN_CMATH_FUNCTION
# include <cmath>
#endif
namespace sprout {
namespace math {
@ -25,11 +23,7 @@ namespace sprout {
}
} // namespace detail
# if SPROUT_USE_BUILTIN_CMATH_FUNCTION
using std::isfinite;
# else
using sprout::math::detail::isfinite;
# endif
using NS_SPROUT_MATH_DETAIL::isfinite;
} // namespace math
using sprout::math::isfinite;

View file

@ -4,10 +4,8 @@
#include <limits>
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/math/detail/config.hpp>
#include <sprout/type_traits/enabler_if.hpp>
#if SPROUT_USE_BUILTIN_CMATH_FUNCTION
# include <cmath>
#endif
namespace sprout {
namespace math {
@ -24,11 +22,7 @@ namespace sprout {
}
} // namespace detail
# if SPROUT_USE_BUILTIN_CMATH_FUNCTION
using std::isinf;
# else
using sprout::math::detail::isinf;
# endif
using NS_SPROUT_MATH_DETAIL::isinf;
} // namespace math
using sprout::math::isinf;

View file

@ -3,10 +3,8 @@
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/math/detail/config.hpp>
#include <sprout/type_traits/enabler_if.hpp>
#if SPROUT_USE_BUILTIN_CMATH_FUNCTION
# include <cmath>
#endif
namespace sprout {
namespace math {
@ -21,11 +19,7 @@ namespace sprout {
}
} // namespace detail
# if SPROUT_USE_BUILTIN_CMATH_FUNCTION
using std::isnan;
# else
using sprout::math::detail::isnan;
# endif
using NS_SPROUT_MATH_DETAIL::isnan;
} // namespace math
using sprout::math::isnan;

View file

@ -4,12 +4,10 @@
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/type_traits/enabler_if.hpp>
#include <sprout/math/detail/config.hpp>
#include <sprout/math/isnan.hpp>
#include <sprout/math/isinf.hpp>
#include <sprout/math/issubnormal.hpp>
#if SPROUT_USE_BUILTIN_CMATH_FUNCTION
# include <cmath>
#endif
namespace sprout {
namespace math {
@ -27,11 +25,7 @@ namespace sprout {
}
} // namespace detail
# if SPROUT_USE_BUILTIN_CMATH_FUNCTION
using std::isnormal;
# else
using sprout::math::detail::isnormal;
# endif
using NS_SPROUT_MATH_DETAIL::isnormal;
} // namespace math
using sprout::math::isnormal;

View file

@ -5,13 +5,11 @@
#include <limits>
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/math/detail/config.hpp>
#include <sprout/math/constants.hpp>
#include <sprout/math/factorial.hpp>
#include <sprout/math/sqrt.hpp>
#include <sprout/type_traits/enabler_if.hpp>
#if SPROUT_USE_BUILTIN_CMATH_FUNCTION
# include <cmath>
#endif
namespace sprout {
namespace math {
@ -69,11 +67,7 @@ namespace sprout {
}
} // namespace detail
# if SPROUT_USE_BUILTIN_CMATH_FUNCTION
using std::log;
# else
using sprout::math::detail::log;
# endif
using NS_SPROUT_MATH_DETAIL::log;
} // namespace math
using sprout::math::log;

View file

@ -3,12 +3,10 @@
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/math/detail/config.hpp>
#include <sprout/math/log.hpp>
#include <sprout/math/constants.hpp>
#include <sprout/type_traits/enabler_if.hpp>
#if SPROUT_USE_BUILTIN_CMATH_FUNCTION
# include <cmath>
#endif
namespace sprout {
namespace math {
@ -32,11 +30,7 @@ namespace sprout {
}
} // namespace detail
# if SPROUT_USE_BUILTIN_CMATH_FUNCTION
using std::log10;
# else
using sprout::math::detail::log10;
# endif
using NS_SPROUT_MATH_DETAIL::log10;
} // namespace math
using sprout::math::log10;

View file

@ -3,11 +3,9 @@
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/math/detail/config.hpp>
#include <sprout/math/log.hpp>
#include <sprout/type_traits/enabler_if.hpp>
#if SPROUT_USE_BUILTIN_CMATH_FUNCTION
# include <cmath>
#endif
namespace sprout {
namespace math {
@ -31,11 +29,7 @@ namespace sprout {
}
} // namespace detail
# if SPROUT_USE_BUILTIN_CMATH_FUNCTION
using std::log1p;
# else
using sprout::math::detail::log1p;
# endif
using NS_SPROUT_MATH_DETAIL::log1p;
} // namespace math
using sprout::math::log1p;

View file

@ -3,12 +3,10 @@
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/math/detail/config.hpp>
#include <sprout/math/log.hpp>
#include <sprout/math/constants.hpp>
#include <sprout/type_traits/enabler_if.hpp>
#if SPROUT_USE_BUILTIN_CMATH_FUNCTION
# include <cmath>
#endif
namespace sprout {
namespace math {
@ -32,11 +30,7 @@ namespace sprout {
}
} // namespace detail
# if SPROUT_USE_BUILTIN_CMATH_FUNCTION
using std::log2;
# else
using sprout::math::detail::log2;
# endif
using NS_SPROUT_MATH_DETAIL::log2;
} // namespace math
using sprout::math::log2;

View file

@ -3,14 +3,12 @@
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/math/detail/config.hpp>
#include <sprout/math/exp.hpp>
#include <sprout/math/log.hpp>
#include <sprout/math/constants.hpp>
#include <sprout/math/float_promote.hpp>
#include <sprout/type_traits/enabler_if.hpp>
#if SPROUT_USE_BUILTIN_CMATH_FUNCTION
# include <cmath>
#endif
namespace sprout {
namespace math {
@ -40,11 +38,7 @@ namespace sprout {
}
} // namespace detail
# if SPROUT_USE_BUILTIN_CMATH_FUNCTION
using std::pow;
# else
using sprout::math::detail::pow;
# endif
using NS_SPROUT_MATH_DETAIL::pow;
} // namespace math
using sprout::math::pow;

View file

@ -3,10 +3,8 @@
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/math/detail/config.hpp>
#include <sprout/type_traits/enabler_if.hpp>
#if SPROUT_USE_BUILTIN_CMATH_FUNCTION
# include <cmath>
#endif
namespace sprout {
namespace math {
@ -21,11 +19,7 @@ namespace sprout {
}
} // namespace detail
# if SPROUT_USE_BUILTIN_CMATH_FUNCTION
using std::signbit;
# else
using sprout::math::detail::signbit;
# endif
using NS_SPROUT_MATH_DETAIL::signbit;
} // namespace math
using sprout::math::signbit;

View file

@ -3,12 +3,10 @@
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/math/detail/config.hpp>
#include <sprout/math/cos.hpp>
#include <sprout/math/constants.hpp>
#include <sprout/type_traits/enabler_if.hpp>
#if SPROUT_USE_BUILTIN_CMATH_FUNCTION
# include <cmath>
#endif
namespace sprout {
namespace math {
@ -32,11 +30,7 @@ namespace sprout {
}
} // namespace detail
# if SPROUT_USE_BUILTIN_CMATH_FUNCTION
using std::sin;
# else
using sprout::math::detail::sin;
# endif
using NS_SPROUT_MATH_DETAIL::sin;
} // namespace math
using sprout::math::sin;

View file

@ -4,11 +4,9 @@
#include <cstddef>
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/math/detail/config.hpp>
#include <sprout/math/factorial.hpp>
#include <sprout/type_traits/enabler_if.hpp>
#if SPROUT_USE_BUILTIN_CMATH_FUNCTION
# include <cmath>
#endif
namespace sprout {
namespace math {
@ -51,11 +49,7 @@ namespace sprout {
}
} // namespace detail
# if SPROUT_USE_BUILTIN_CMATH_FUNCTION
using std::sinh;
# else
using sprout::math::detail::sinh;
# endif
using NS_SPROUT_MATH_DETAIL::sinh;
} // namespace math
using sprout::math::sinh;

View file

@ -4,10 +4,8 @@
#include <limits>
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/math/detail/config.hpp>
#include <sprout/type_traits/enabler_if.hpp>
#if SPROUT_USE_BUILTIN_CMATH_FUNCTION
# include <cmath>
#endif
namespace sprout {
namespace math {
@ -59,11 +57,7 @@ namespace sprout {
}
} // namespace detail
# if SPROUT_USE_BUILTIN_CMATH_FUNCTION
using std::sqrt;
# else
using sprout::math::detail::sqrt;
# endif
using NS_SPROUT_MATH_DETAIL::sqrt;
} // namespace math
using sprout::math::sqrt;

View file

@ -3,12 +3,10 @@
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/math/detail/config.hpp>
#include <sprout/math/sin.hpp>
#include <sprout/math/cos.hpp>
#include <sprout/type_traits/enabler_if.hpp>
#if SPROUT_USE_BUILTIN_CMATH_FUNCTION
# include <cmath>
#endif
namespace sprout {
namespace math {
@ -32,11 +30,7 @@ namespace sprout {
}
} // namespace detail
# if SPROUT_USE_BUILTIN_CMATH_FUNCTION
using std::tan;
# else
using sprout::math::detail::tan;
# endif
using NS_SPROUT_MATH_DETAIL::tan;
} // namespace math
using sprout::math::tan;

View file

@ -3,12 +3,10 @@
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/math/detail/config.hpp>
#include <sprout/math/sinh.hpp>
#include <sprout/math/cosh.hpp>
#include <sprout/type_traits/enabler_if.hpp>
#if SPROUT_USE_BUILTIN_CMATH_FUNCTION
# include <cmath>
#endif
namespace sprout {
namespace math {
@ -32,11 +30,7 @@ namespace sprout {
}
} // namespace detail
# if SPROUT_USE_BUILTIN_CMATH_FUNCTION
using std::tanh;
# else
using sprout::math::detail::tanh;
# endif
using NS_SPROUT_MATH_DETAIL::tanh;
} // namespace math
using sprout::math::tanh;