1
0
Fork 0
mirror of https://github.com/bolero-MURAKAMI/Sprout synced 2024-11-12 21:09:01 +00:00

fix min/max use

This commit is contained in:
bolero-MURAKAMI 2013-11-10 22:13:25 +09:00
parent 2b08b8e1d5
commit 09bff1e262
3 changed files with 8 additions and 8 deletions

View file

@ -11,10 +11,10 @@
#include <type_traits> #include <type_traits>
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/limits.hpp> #include <sprout/limits.hpp>
#include <sprout/algorithm/detail/max.hpp>
#include <sprout/math/fabs.hpp> #include <sprout/math/fabs.hpp>
#include <sprout/type_traits/arithmetic_promote.hpp> #include <sprout/type_traits/arithmetic_promote.hpp>
#include <sprout/type_traits/enabler_if.hpp> #include <sprout/type_traits/enabler_if.hpp>
#include <sprout/algorithm/detail/max.hpp>
namespace sprout { namespace sprout {
namespace math { namespace math {

View file

@ -13,13 +13,13 @@
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/limits.hpp> #include <sprout/limits.hpp>
#include <sprout/assert.hpp> #include <sprout/assert.hpp>
#include <sprout/algorithm/min.hpp>
#include <sprout/math/pow.hpp> #include <sprout/math/pow.hpp>
#include <sprout/math/floor.hpp> #include <sprout/math/floor.hpp>
#include <sprout/random/detail/const_mod.hpp> #include <sprout/random/detail/const_mod.hpp>
#include <sprout/random/detail/signed_unsigned_tools.hpp> #include <sprout/random/detail/signed_unsigned_tools.hpp>
#include <sprout/random/detail/generator_bits.hpp> #include <sprout/random/detail/generator_bits.hpp>
#include <sprout/utility/pair/pair.hpp> #include <sprout/utility/pair/pair.hpp>
#include HDR_ALGORITHM_MIN_MAX_SSCRISK_CEL_OR_SPROUT
namespace sprout { namespace sprout {
namespace random { namespace random {
@ -32,7 +32,7 @@ namespace sprout {
RealType mult = r; RealType mult = r;
RealType limit = sprout::math::pow( RealType limit = sprout::math::pow(
RealType(2), RealType(2),
RealType(sprout::min(bits, static_cast<std::size_t>(sprout::numeric_limits<RealType>::digits))) RealType(NS_SSCRISK_CEL_OR_SPROUT::min(bits, static_cast<std::size_t>(sprout::numeric_limits<RealType>::digits)))
); );
RealType s = RealType(sprout::random::detail::subtract<base_result>()(static_cast<base_result>(rng()), rng.min())); RealType s = RealType(sprout::random::detail::subtract<base_result>()(static_cast<base_result>(rng()), rng.min()));
while (mult < limit) { while (mult < limit) {
@ -51,7 +51,7 @@ namespace sprout {
RealType r = sprout::math::pow(RealType(2), RealType(sprout::random::detail::generator_bits<URNG>::value())); RealType r = sprout::math::pow(RealType(2), RealType(sprout::random::detail::generator_bits<URNG>::value()));
RealType limit = sprout::math::pow( RealType limit = sprout::math::pow(
RealType(2), RealType(2),
RealType(sprout::min(bits, static_cast<std::size_t>(sprout::numeric_limits<RealType>::digits))) RealType(NS_SSCRISK_CEL_OR_SPROUT::min(bits, static_cast<std::size_t>(sprout::numeric_limits<RealType>::digits)))
); );
RealType s = RealType(static_cast<base_result>(rng()) - rng.min()); RealType s = RealType(static_cast<base_result>(rng()) - rng.min());
RealType mult = r; RealType mult = r;
@ -123,7 +123,7 @@ namespace sprout {
RealType(rng.max()) - RealType(rng.min()) + 1, RealType(rng.max()) - RealType(rng.min()) + 1,
sprout::math::pow( sprout::math::pow(
RealType(2), RealType(2),
RealType(sprout::min(bits, static_cast<std::size_t>(sprout::numeric_limits<RealType>::digits))) RealType(NS_SSCRISK_CEL_OR_SPROUT::min(bits, static_cast<std::size_t>(sprout::numeric_limits<RealType>::digits)))
), ),
rng() rng()
); );
@ -169,7 +169,7 @@ namespace sprout {
sprout::math::pow(RealType(2), RealType(sprout::random::detail::generator_bits<URNG>::value())), sprout::math::pow(RealType(2), RealType(sprout::random::detail::generator_bits<URNG>::value())),
sprout::math::pow( sprout::math::pow(
RealType(2), RealType(2),
RealType(sprout::min(bits, static_cast<std::size_t>(sprout::numeric_limits<RealType>::digits))) RealType(NS_SSCRISK_CEL_OR_SPROUT::min(bits, static_cast<std::size_t>(sprout::numeric_limits<RealType>::digits)))
), ),
rng() rng()
); );

View file

@ -22,7 +22,6 @@
#include <sprout/iterator/type_traits/is_iterator_of.hpp> #include <sprout/iterator/type_traits/is_iterator_of.hpp>
#include <sprout/type_traits/enabler_if.hpp> #include <sprout/type_traits/enabler_if.hpp>
#include <sprout/algorithm/fixed/result_of.hpp> #include <sprout/algorithm/fixed/result_of.hpp>
#include <sprout/algorithm/max.hpp>
#include <sprout/algorithm/fixed/copy.hpp> #include <sprout/algorithm/fixed/copy.hpp>
#include <sprout/algorithm/fixed/transform.hpp> #include <sprout/algorithm/fixed/transform.hpp>
#include <sprout/algorithm/cxx14/copy.hpp> #include <sprout/algorithm/cxx14/copy.hpp>
@ -31,6 +30,7 @@
#include <sprout/container/functions.hpp> #include <sprout/container/functions.hpp>
#include <sprout/pit/pit.hpp> #include <sprout/pit/pit.hpp>
#include <sprout/detail/container_complate.hpp> #include <sprout/detail/container_complate.hpp>
#include HDR_ALGORITHM_MIN_MAX_SSCRISK_CEL_OR_SPROUT
namespace sprout { namespace sprout {
namespace random { namespace random {
@ -278,7 +278,7 @@ namespace sprout {
sprout::fill(begin, end, static_cast<value_type>(0x8b8b8b8bu)); sprout::fill(begin, end, static_cast<value_type>(0x8b8b8b8bu));
size_type n = end - begin; size_type n = end - begin;
size_type s = size(); size_type s = size();
size_type m = sprout::max(s + 1, n); size_type m = NS_SSCRISK_CEL_OR_SPROUT::max(s + 1, n);
size_type t = tval(n); size_type t = tval(n);
size_type p = (n - t) / 2; size_type p = (n - t) / 2;
size_type q = p + t; size_type q = p + t;