diff --git a/glm/detail/_vectorize.hpp b/glm/detail/_vectorize.hpp index 48fe97f3..4f067998 100644 --- a/glm/detail/_vectorize.hpp +++ b/glm/detail/_vectorize.hpp @@ -141,6 +141,18 @@ VECTORIZE3_VEC_SCA(func) \ VECTORIZE4_VEC_SCA(func) +#define VECTORIZE1_VEC_VEC(func) \ + template \ + GLM_FUNC_QUALIFIER detail::tvec1 func \ + ( \ + detail::tvec1 const & x, \ + detail::tvec1 const & y \ + ) \ + { \ + return detail::tvec1( \ + func(x.x, y.x)); \ + } + #define VECTORIZE2_VEC_VEC(func) \ template \ GLM_FUNC_QUALIFIER detail::tvec2 func \ @@ -184,6 +196,7 @@ } #define VECTORIZE_VEC_VEC(func) \ + VECTORIZE1_VEC_VEC(func) \ VECTORIZE2_VEC_VEC(func) \ VECTORIZE3_VEC_VEC(func) \ VECTORIZE4_VEC_VEC(func) diff --git a/glm/detail/func_common.inl b/glm/detail/func_common.inl index 814b0a93..f43541f9 100644 --- a/glm/detail/func_common.inl +++ b/glm/detail/func_common.inl @@ -254,6 +254,8 @@ namespace detail VECTORIZE_VEC(roundEven) // ceil + using std::ceil; +/* template GLM_FUNC_QUALIFIER genType ceil(genType const & x) { @@ -263,7 +265,7 @@ namespace detail return ::std::ceil(x); } - +*/ VECTORIZE_VEC(ceil) // fract @@ -273,9 +275,7 @@ namespace detail genType const & x ) { - GLM_STATIC_ASSERT( - std::numeric_limits::is_iec559, - "'fract' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'fract' only accept floating-point inputs"); return x - floor(x); } @@ -286,13 +286,11 @@ namespace detail template GLM_FUNC_QUALIFIER genType mod ( - genType const & x, + genType const & x, genType const & y ) { - GLM_STATIC_ASSERT( - std::numeric_limits::is_iec559, - "'mod' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'mod' only accept floating-point inputs"); return x - y * floor(x / y); } @@ -304,13 +302,11 @@ namespace detail template GLM_FUNC_QUALIFIER genType modf ( - genType const & x, + genType const & x, genType & i ) { - GLM_STATIC_ASSERT( - std::numeric_limits::is_iec559, - "'modf' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'modf' only accept floating-point inputs"); return std::modf(x, &i); } @@ -573,9 +569,7 @@ namespace detail vecType const & x ) { - GLM_STATIC_ASSERT( - std::numeric_limits::is_iec559, - "'step' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'step' only accept floating-point inputs"); return mix(vecType(1), vecType(0), glm::lessThan(x, vecType(edge))); } @@ -589,9 +583,7 @@ namespace detail genType const & x ) { - GLM_STATIC_ASSERT( - std::numeric_limits::is_iec559, - "'smoothstep' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'smoothstep' only accept floating-point inputs"); genType tmp = clamp((x - edge0) / (edge1 - edge0), genType(0), genType(1)); return tmp * tmp * (genType(3) - genType(2) * tmp); @@ -605,9 +597,7 @@ namespace detail detail::tvec2 const & x ) { - GLM_STATIC_ASSERT( - std::numeric_limits::is_iec559, - "'smoothstep' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'smoothstep' only accept floating-point inputs"); return detail::tvec2( smoothstep(edge0, edge1, x.x), @@ -622,9 +612,7 @@ namespace detail detail::tvec3 const & x ) { - GLM_STATIC_ASSERT( - std::numeric_limits::is_iec559, - "'smoothstep' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'smoothstep' only accept floating-point inputs"); return detail::tvec3( smoothstep(edge0, edge1, x.x), @@ -640,9 +628,7 @@ namespace detail detail::tvec4 const & x ) { - GLM_STATIC_ASSERT( - std::numeric_limits::is_iec559, - "'smoothstep' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'smoothstep' only accept floating-point inputs"); return detail::tvec4( smoothstep(edge0, edge1, x.x), @@ -659,9 +645,7 @@ namespace detail detail::tvec2 const & x ) { - GLM_STATIC_ASSERT( - std::numeric_limits::is_iec559, - "'smoothstep' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'smoothstep' only accept floating-point inputs"); return detail::tvec2( smoothstep(edge0.x, edge1.x, x.x), @@ -676,9 +660,7 @@ namespace detail detail::tvec3 const & x ) { - GLM_STATIC_ASSERT( - std::numeric_limits::is_iec559, - "'smoothstep' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'smoothstep' only accept floating-point inputs"); return detail::tvec3( smoothstep(edge0.x, edge1.x, x.x), @@ -694,9 +676,7 @@ namespace detail detail::tvec4 const & x ) { - GLM_STATIC_ASSERT( - std::numeric_limits::is_iec559, - "'smoothstep' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'smoothstep' only accept floating-point inputs"); return detail::tvec4( smoothstep(edge0.x, edge1.x, x.x), @@ -709,9 +689,7 @@ namespace detail template GLM_FUNC_QUALIFIER bool isnan(genType const & x) { - GLM_STATIC_ASSERT( - std::numeric_limits::is_iec559, - "'isnan' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'isnan' only accept floating-point inputs"); # if(GLM_LANG & GLM_LANG_CXX11_FLAG) return std::isnan(x); @@ -730,15 +708,25 @@ namespace detail # endif } + template + GLM_FUNC_QUALIFIER typename detail::tvec1::bool_type isnan + ( + detail::tvec1 const & x + ) + { + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'isnan' only accept floating-point inputs"); + + return typename detail::tvec1::bool_type( + isnan(x.x)); + } + template GLM_FUNC_QUALIFIER typename detail::tvec2::bool_type isnan ( detail::tvec2 const & x ) { - GLM_STATIC_ASSERT( - std::numeric_limits::is_iec559, - "'isnan' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'isnan' only accept floating-point inputs"); return typename detail::tvec2::bool_type( isnan(x.x), @@ -751,9 +739,7 @@ namespace detail detail::tvec3 const & x ) { - GLM_STATIC_ASSERT( - std::numeric_limits::is_iec559, - "'isnan' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'isnan' only accept floating-point inputs"); return typename detail::tvec3::bool_type( isnan(x.x), @@ -767,9 +753,7 @@ namespace detail detail::tvec4 const & x ) { - GLM_STATIC_ASSERT( - std::numeric_limits::is_iec559, - "'isnan' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'isnan' only accept floating-point inputs"); return typename detail::tvec4::bool_type( isnan(x.x), @@ -802,15 +786,25 @@ namespace detail # endif } + template + GLM_FUNC_QUALIFIER typename detail::tvec1::bool_type isinf + ( + detail::tvec1 const & x + ) + { + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'isinf' only accept floating-point inputs"); + + return typename detail::tvec1::bool_type( + isinf(x.x)); + } + template GLM_FUNC_QUALIFIER typename detail::tvec2::bool_type isinf ( detail::tvec2 const & x ) { - GLM_STATIC_ASSERT( - std::numeric_limits::is_iec559, - "'isinf' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'isinf' only accept floating-point inputs"); return typename detail::tvec2::bool_type( isinf(x.x), @@ -823,9 +817,7 @@ namespace detail detail::tvec3 const & x ) { - GLM_STATIC_ASSERT( - std::numeric_limits::is_iec559, - "'isinf' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'isinf' only accept floating-point inputs"); return typename detail::tvec3::bool_type( isinf(x.x), @@ -839,9 +831,7 @@ namespace detail detail::tvec4 const & x ) { - GLM_STATIC_ASSERT( - std::numeric_limits::is_iec559, - "'isinf' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'isinf' only accept floating-point inputs"); return typename detail::tvec4::bool_type( isinf(x.x), @@ -912,13 +902,23 @@ namespace detail int & exp ) { - GLM_STATIC_ASSERT( - std::numeric_limits::is_iec559, - "'frexp' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'frexp' only accept floating-point inputs"); return std::frexp(x, exp); } + template + GLM_FUNC_QUALIFIER detail::tvec1 frexp + ( + detail::tvec1 const & x, + detail::tvec1 & exp + ) + { + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'frexp' only accept floating-point inputs"); + + return detail::tvec1(std::frexp(x.x, exp.x)); + } + template GLM_FUNC_QUALIFIER detail::tvec2 frexp ( @@ -926,9 +926,7 @@ namespace detail detail::tvec2 & exp ) { - GLM_STATIC_ASSERT( - std::numeric_limits::is_iec559, - "'frexp' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'frexp' only accept floating-point inputs"); return detail::tvec2( frexp(x.x, exp.x), @@ -942,9 +940,7 @@ namespace detail detail::tvec3 & exp ) { - GLM_STATIC_ASSERT( - std::numeric_limits::is_iec559, - "'frexp' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'frexp' only accept floating-point inputs"); return detail::tvec3( frexp(x.x, exp.x), @@ -959,9 +955,7 @@ namespace detail detail::tvec4 & exp ) { - GLM_STATIC_ASSERT( - std::numeric_limits::is_iec559, - "'frexp' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'frexp' only accept floating-point inputs"); return detail::tvec4( frexp(x.x, exp.x), @@ -977,13 +971,24 @@ namespace detail int const & exp ) { - GLM_STATIC_ASSERT( - std::numeric_limits::is_iec559, - "'frexp' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'ldexp' only accept floating-point inputs"); return std::ldexp(x, exp); } + template + GLM_FUNC_QUALIFIER detail::tvec1 ldexp + ( + detail::tvec1 const & x, + detail::tvec1 const & exp + ) + { + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'ldexp' only accept floating-point inputs"); + + return detail::tvec1( + ldexp(x.x, exp.x)); + } + template GLM_FUNC_QUALIFIER detail::tvec2 ldexp ( @@ -991,9 +996,7 @@ namespace detail detail::tvec2 const & exp ) { - GLM_STATIC_ASSERT( - std::numeric_limits::is_iec559, - "'ldexp' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'ldexp' only accept floating-point inputs"); return detail::tvec2( ldexp(x.x, exp.x), @@ -1007,9 +1010,7 @@ namespace detail detail::tvec3 const & exp ) { - GLM_STATIC_ASSERT( - std::numeric_limits::is_iec559, - "'ldexp' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'ldexp' only accept floating-point inputs"); return detail::tvec3( ldexp(x.x, exp.x), @@ -1024,9 +1025,7 @@ namespace detail detail::tvec4 const & exp ) { - GLM_STATIC_ASSERT( - std::numeric_limits::is_iec559, - "'ldexp' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'ldexp' only accept floating-point inputs"); return detail::tvec4( ldexp(x.x, exp.x), diff --git a/glm/detail/func_exponential.inl b/glm/detail/func_exponential.inl index 767323f7..4e68073a 100644 --- a/glm/detail/func_exponential.inl +++ b/glm/detail/func_exponential.inl @@ -29,6 +29,7 @@ #include "func_vector_relational.hpp" #include "_vectorize.hpp" #include +#include #include namespace glm{ @@ -47,7 +48,11 @@ namespace detail template GLM_FUNC_QUALIFIER T operator() (T const & Value) const { - return static_cast(::std::log(Value)) * static_cast(1.4426950408889634073599246810019); +# if(GLM_LANG & GLM_LANG_CXX11_FLAG) + return std::log2(Value); +# else + return std::log(Value) * static_cast(1.4426950408889634073599246810019); +# endif } }; @@ -78,6 +83,9 @@ namespace detail }//namespace detail // pow + using std::pow; + +/* template GLM_FUNC_QUALIFIER genType pow ( @@ -91,10 +99,14 @@ namespace detail return std::pow(x, y); } +*/ VECTORIZE_VEC_VEC(pow) // exp + using std::exp; + +/* template GLM_FUNC_QUALIFIER genType exp ( @@ -107,10 +119,13 @@ namespace detail return std::exp(x); } +*/ VECTORIZE_VEC(exp) // log + using std::log; +/* template GLM_FUNC_QUALIFIER genType log ( @@ -123,7 +138,7 @@ namespace detail return std::log(x); } - +*/ VECTORIZE_VEC(log) //exp2, ln2 = 0.69314718055994530941723212145818f @@ -195,6 +210,8 @@ namespace detail }//namespace detail // sqrt + using std::sqrt; +/* GLM_FUNC_QUALIFIER float sqrt(float x) { # ifdef __CUDACC__ // Wordaround for a CUDA compiler bug up to CUDA6 @@ -214,7 +231,7 @@ namespace detail return detail::compute_sqrt::call(x).x; # endif } - +*/ template class vecType> GLM_FUNC_QUALIFIER vecType sqrt(vecType const & x) { diff --git a/glm/detail/func_trigonometric.hpp b/glm/detail/func_trigonometric.hpp index b3148c14..e609dfec 100644 --- a/glm/detail/func_trigonometric.hpp +++ b/glm/detail/func_trigonometric.hpp @@ -39,6 +39,8 @@ #pragma once +#include "setup.hpp" + namespace glm { /// @addtogroup core_func_trigonometric @@ -50,7 +52,7 @@ namespace glm /// /// @see GLSL radians man page /// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions - template + template GLM_FUNC_DECL genType radians(genType const & degrees); /// Converts radians to degrees and returns the result. @@ -59,7 +61,7 @@ namespace glm /// /// @see GLSL degrees man page /// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions - template + template GLM_FUNC_DECL genType degrees(genType const & radians); /// The standard trigonometric sine function. diff --git a/glm/detail/func_trigonometric.inl b/glm/detail/func_trigonometric.inl index 2ab9dac7..d884a305 100644 --- a/glm/detail/func_trigonometric.inl +++ b/glm/detail/func_trigonometric.inl @@ -61,6 +61,8 @@ namespace glm VECTORIZE_VEC(degrees) // sin + using std::sin; +/* template GLM_FUNC_QUALIFIER genType sin ( @@ -71,10 +73,12 @@ namespace glm return genType(::std::sin(angle)); } - +*/ VECTORIZE_VEC(sin) // cos + using std::cos; +/* template GLM_FUNC_QUALIFIER genType cos(genType const & angle) { @@ -82,10 +86,13 @@ namespace glm return genType(::std::cos(angle)); } +*/ VECTORIZE_VEC(cos) // tan + using std::tan; +/* template GLM_FUNC_QUALIFIER genType tan ( @@ -96,10 +103,13 @@ namespace glm return genType(::std::tan(angle)); } +*/ VECTORIZE_VEC(tan) // asin + using std::asin; +/* template GLM_FUNC_QUALIFIER genType asin ( @@ -110,10 +120,12 @@ namespace glm return genType(::std::asin(x)); } - +*/ VECTORIZE_VEC(asin) // acos + using std::acos; +/* template GLM_FUNC_QUALIFIER genType acos ( @@ -122,26 +134,28 @@ namespace glm { GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'acos' only accept floating-point input"); - return genType(::std::acos(x)); + return ::std::acos(x); } - +*/ VECTORIZE_VEC(acos) // atan template GLM_FUNC_QUALIFIER genType atan ( - genType const & y, + genType const & y, genType const & x ) { GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'atan' only accept floating-point input"); - return genType(::std::atan2(y, x)); + return ::std::atan2(y, x); } VECTORIZE_VEC_VEC(atan) + using std::atan; +/* template GLM_FUNC_QUALIFIER genType atan ( @@ -150,12 +164,14 @@ namespace glm { GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'atan' only accept floating-point input"); - return genType(::std::atan(x)); + return ::std::atan(x); } - +*/ VECTORIZE_VEC(atan) // sinh + using std::sinh; +/* template GLM_FUNC_QUALIFIER genType sinh ( @@ -164,12 +180,14 @@ namespace glm { GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'sinh' only accept floating-point input"); - return genType(std::sinh(angle)); + return ::std::sinh(angle); } - +*/ VECTORIZE_VEC(sinh) // cosh + using std::cosh; +/* template GLM_FUNC_QUALIFIER genType cosh ( @@ -178,12 +196,14 @@ namespace glm { GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'cosh' only accept floating-point input"); - return genType(std::cosh(angle)); + return ::std::cosh(angle); } - +*/ VECTORIZE_VEC(cosh) // tanh + using std::tanh; +/* template GLM_FUNC_QUALIFIER genType tanh ( @@ -192,54 +212,57 @@ namespace glm { GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'tanh' only accept floating-point input"); - return genType(std::tanh(angle)); + return ::std::tanh(angle); } - +*/ VECTORIZE_VEC(tanh) // asinh - template - GLM_FUNC_QUALIFIER genType asinh - ( - genType const & x - ) - { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'asinh' only accept floating-point input"); - - return (x < genType(0) ? genType(-1) : (x > genType(0) ? genType(1) : genType(0))) * log(abs(x) + sqrt(genType(1) + x * x)); - } +# if(GLM_LANG & GLM_LANG_CXX11_FLAG) + using std::asinh; +# else + template + GLM_FUNC_QUALIFIER genType asinh(genType const & x) + { + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'asinh' only accept floating-point input"); + + return (x < static_cast(0) ? static_cast(-1) : (x > static_cast(0) ? static_cast(1) : static_cast(0))) * log(abs(x) + sqrt(static_cast(1) + x * x)); + } +# endif VECTORIZE_VEC(asinh) // acosh - template - GLM_FUNC_QUALIFIER genType acosh - ( - genType const & x - ) - { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'acosh' only accept floating-point input"); +# if(GLM_LANG & GLM_LANG_CXX11_FLAG) + using std::acosh; +# else + template + GLM_FUNC_QUALIFIER genType acosh(genType const & x) + { + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'acosh' only accept floating-point input"); - if(x < genType(1)) - return genType(0); - return log(x + sqrt(x * x - genType(1))); - } + if(x < static_cast(1)) + return static_cast(0); + return log(x + sqrt(x * x - static_cast(1))); + } +# endif VECTORIZE_VEC(acosh) // atanh - template - GLM_FUNC_QUALIFIER genType atanh - ( - genType const & x - ) - { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'atanh' only accept floating-point input"); +# if(GLM_LANG & GLM_LANG_CXX11_FLAG) + using std::atanh; +# else + template + GLM_FUNC_QUALIFIER genType atanh(genType const & x) + { + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'atanh' only accept floating-point input"); - if(abs(x) >= genType(1)) - return 0; - return genType(0.5) * log((genType(1) + x) / (genType(1) - x)); - } + if(abs(x) >= static_cast(1)) + return 0; + return static_cast(0.5) * log((static_cast(1) + x) / (static_cast(1) - x)); + } +# endif VECTORIZE_VEC(atanh) diff --git a/test/core/core_func_exponential.cpp b/test/core/core_func_exponential.cpp index bc1966cd..33f16fc7 100644 --- a/test/core/core_func_exponential.cpp +++ b/test/core/core_func_exponential.cpp @@ -10,34 +10,116 @@ #include #include #include +#include -namespace inversesqrt +int test_pow() { - int test() + int Error(0); + + float A = glm::pow(10.f, 10.f); + glm::vec1 B = glm::pow(glm::vec1(10.f), glm::vec1(10.f)); + glm::vec2 C = glm::pow(glm::vec2(10.f), glm::vec2(10.f)); + glm::vec3 D = glm::pow(glm::vec3(10.f), glm::vec3(10.f)); + glm::vec4 E = glm::pow(glm::vec4(10.f), glm::vec4(10.f)); + + return Error; +} + +int test_exp() +{ + int Error(0); + + float A = glm::exp(10.f); + glm::vec1 B = glm::exp(glm::vec1(10.f)); + glm::vec2 C = glm::exp(glm::vec2(10.f)); + glm::vec3 D = glm::exp(glm::vec3(10.f)); + glm::vec4 E = glm::exp(glm::vec4(10.f)); + + return Error; +} + +int test_log() +{ + int Error(0); + + float A = glm::log(10.f); + glm::vec1 B = glm::log(glm::vec1(10.f)); + glm::vec2 C = glm::log(glm::vec2(10.f)); + glm::vec3 D = glm::log(glm::vec3(10.f)); + glm::vec4 E = glm::log(glm::vec4(10.f)); + + return Error; +} + +int test_exp2() +{ + int Error(0); + + float A = glm::exp2(10.f); + glm::vec1 B = glm::exp2(glm::vec1(10.f)); + glm::vec2 C = glm::exp2(glm::vec2(10.f)); + glm::vec3 D = glm::exp2(glm::vec3(10.f)); + glm::vec4 E = glm::exp2(glm::vec4(10.f)); + + return Error; +} + +int test_log2() +{ + int Error(0); + + float A = glm::log2(10.f); + glm::vec1 B = glm::log2(glm::vec1(10.f)); + glm::vec2 C = glm::log2(glm::vec2(10.f)); + glm::vec3 D = glm::log2(glm::vec3(10.f)); + glm::vec4 E = glm::log2(glm::vec4(10.f)); + + return Error; +} + +int test_sqrt() +{ + int Error(0); + + float A = glm::sqrt(10.f); + glm::vec1 B = glm::sqrt(glm::vec1(10.f)); + glm::vec2 C = glm::sqrt(glm::vec2(10.f)); + glm::vec3 D = glm::sqrt(glm::vec3(10.f)); + glm::vec4 E = glm::sqrt(glm::vec4(10.f)); + + return Error; +} + +int test_inversesqrt() +{ + int Error(0); + + glm::uint ulp(0); + float diff(0.0f); + + for(float f = 0.001f; f < 10.f; f *= 1.001f) { - int Error(0); + glm::lowp_fvec1 lowp_v = glm::inversesqrt(glm::lowp_fvec1(f)); + float defaultp_v = glm::inversesqrt(f); - glm::uint ulp(0); - float diff(0.0f); - - for(float f = 0.001f; f < 10.f; f *= 1.001f) - { - glm::lowp_fvec1 lowp_v = glm::inversesqrt(glm::lowp_fvec1(f)); - float defaultp_v = glm::inversesqrt(f); - - ulp = glm::max(glm::float_distance(lowp_v.x, defaultp_v), ulp); - diff = glm::abs(lowp_v.x - defaultp_v); - } - - return Error; + ulp = glm::max(glm::float_distance(lowp_v.x, defaultp_v), ulp); + diff = glm::abs(lowp_v.x - defaultp_v); } -}//namespace inversesqrt + + return Error; +} int main() { int Error(0); - Error += inversesqrt::test(); + Error += test_pow(); + Error += test_exp(); + Error += test_log(); + Error += test_exp2(); + Error += test_log2(); + Error += test_sqrt(); + Error += test_inversesqrt(); return Error; } diff --git a/test/core/core_func_trigonometric.cpp b/test/core/core_func_trigonometric.cpp index 57dff974..6c7ac3c4 100644 --- a/test/core/core_func_trigonometric.cpp +++ b/test/core/core_func_trigonometric.cpp @@ -7,7 +7,7 @@ // File : test/core/func_trigonometric.cpp /////////////////////////////////////////////////////////////////////////////////////////////////// -#include +#include int main() { diff --git a/test/gtx/gtx_integer.cpp b/test/gtx/gtx_integer.cpp index 72725a3e..9fd9d1e0 100644 --- a/test/gtx/gtx_integer.cpp +++ b/test/gtx/gtx_integer.cpp @@ -7,6 +7,7 @@ // File : test/gtx/gtx_integer.cpp /////////////////////////////////////////////////////////////////////////////////////////////////// +#include #include #include #include