diff --git a/glm/gtx/component_wise.inl b/glm/gtx/component_wise.inl index 3a993dbce..f8217b2ef 100644 --- a/glm/gtx/component_wise.inl +++ b/glm/gtx/component_wise.inl @@ -1,5 +1,6 @@ /// @ref gtx_component_wise +#include "../ext/scalar_common.hpp" #include #include @@ -126,21 +127,21 @@ namespace detail return Result; } - template::value, T>::type> + template GLM_FUNC_QUALIFIER T fcompMin(vec const& v) { T Result(v[0]); for(length_t i = 1, n = v.length(); i < n; ++i) - Result = std::fmin(Result, v[i]); + Result = fmin(Result, v[i]); return Result; } - template::value, T>::type> + template GLM_FUNC_QUALIFIER T fcompMax(vec const& v) { T Result(v[0]); for(length_t i = 1, n = v.length(); i < n; ++i) - Result = std::fmax(Result, v[i]); + Result = fmax(Result, v[i]); return Result; } }//namespace glm diff --git a/test/gtx/gtx_component_wise.cpp b/test/gtx/gtx_component_wise.cpp index f8d8c7819..03a91b1b4 100644 --- a/test/gtx/gtx_component_wise.cpp +++ b/test/gtx/gtx_component_wise.cpp @@ -3,6 +3,8 @@ #include #include #include +#include +#include #include namespace compNormalize @@ -105,6 +107,7 @@ namespace compScale } }// compScale +#if ((GLM_LANG & GLM_LANG_CXX11_FLAG) || (GLM_COMPILER & GLM_COMPILER_VC)) namespace fcompMax { static int run() @@ -114,13 +117,13 @@ namespace fcompMax { float const A = glm::fcompMax(glm::vec4(NAN, 0.2f, 0.5f, 1.0f)); - Error += A == 1.0f ? 0 : 1; + Error += glm::equal(A, 1.0f, glm::epsilon()) ? 0 : 1; } { float const A = glm::fcompMax(glm::vec4(2.0f, NAN, 0.3f, 0.7f)); - Error += A == 2.0f ? 0 : 1; + Error += glm::equal(A, 2.0f, glm::epsilon()) ? 0 : 1; } { @@ -142,13 +145,13 @@ namespace fcompMin { float const A = glm::fcompMin(glm::vec4(NAN, 0.2f, 0.5f, 1.0f)); - Error += A == 0.2f ? 0 : 1; + Error += glm::equal(A, 0.2f, glm::epsilon()) ? 0 : 1; } { float const A = glm::fcompMin(glm::vec4(2.0f, NAN, 0.3f, 0.7f)); - Error += A == 0.3f ? 0 : 1; + Error += glm::equal(A, 0.3f, glm::epsilon()) ? 0 : 1; } { @@ -161,6 +164,7 @@ namespace fcompMin return Error; } }// fcompMin +#endif//((GLM_LANG & GLM_LANG_CXX11_FLAG) || (GLM_COMPILER & GLM_COMPILER_VC)) int main() { @@ -168,8 +172,11 @@ int main() Error += compNormalize::run(); Error += compScale::run(); + +#if ((GLM_LANG & GLM_LANG_CXX11_FLAG) || (GLM_COMPILER & GLM_COMPILER_VC)) Error += fcompMax::run(); Error += fcompMin::run(); +#endif//((GLM_LANG & GLM_LANG_CXX11_FLAG) || (GLM_COMPILER & GLM_COMPILER_VC)) return Error; }