From 0050336dedbf1879e403dcd2b059bc645ee8d561 Mon Sep 17 00:00:00 2001 From: Keith O'Hara Date: Sun, 28 Oct 2018 15:49:19 -0400 Subject: [PATCH] quiet some issues with Windows build --- .appveyor.yml | 1 + include/gcem_incl/binomial_coef.hpp | 2 +- include/gcem_incl/factorial.hpp | 20 ++++++++++++-------- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index d3cad75..d7cea35 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -53,3 +53,4 @@ build_script: - .\sqrt.test - .\tan.test - .\tanh.test + - ls -al diff --git a/include/gcem_incl/binomial_coef.hpp b/include/gcem_incl/binomial_coef.hpp index 9ea810b..b2c033a 100644 --- a/include/gcem_incl/binomial_coef.hpp +++ b/include/gcem_incl/binomial_coef.hpp @@ -57,7 +57,7 @@ binomial_coef(const pT n, const pT k) // if internal::binomial_coef_recur(n,k) : // else - internal::binomial_coef_recur(n,k) ); + internal::binomial_coef_recur(static_cast(n),static_cast(k)) ); } #endif \ No newline at end of file diff --git a/include/gcem_incl/factorial.hpp b/include/gcem_incl/factorial.hpp index 366c4f3..ce8427a 100644 --- a/include/gcem_incl/factorial.hpp +++ b/include/gcem_incl/factorial.hpp @@ -49,10 +49,10 @@ factorial_table(const T x) T(20922789888000) ); } -template +template::value>::type* = nullptr> constexpr T -factorial_integer(const T x) +factorial_recur(const T x) { return( x == T(0) ? T(1) : x == T(1) ? x : @@ -61,7 +61,15 @@ factorial_integer(const T x) // if factorial_table(x) : // else - x*factorial_integer(x-1) ); + x*factorial_recur(x-1) ); +} + +template::value>::type* = nullptr> +constexpr +T +factorial_recur(const T x) +{ + return tgamma(x + 1); } } @@ -80,11 +88,7 @@ constexpr T factorial(const T x) { - return( std::is_integral::value ? \ - // if - internal::factorial_integer(x) : - // else - tgamma(x + 1) ); + return internal::factorial_recur(x); } #endif