/////////////////////////////////////////////////////////////////////////////////////////////////// // OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) /////////////////////////////////////////////////////////////////////////////////////////////////// // Created : 2013-10-25 // Updated : 2013-10-25 // Licence : This source is under MIT licence // File : test/gtx/fast_trigonometry.cpp /////////////////////////////////////////////////////////////////////////////////////////////////// #include #include #include #include namespace fastCos{ int perf() { const float begin = -glm::pi(); const float end = glm::pi(); float result = 0.f; const std::clock_t timestamp1 = std::clock(); for(float i=begin; i(time_fastCos)); std::printf("cos Time %d clocks\n", static_cast(time_cos)); return time_fastCos < time_cos ? 0 : 1; } } namespace fastSin{ int perf() { const float begin = -glm::pi(); const float end = glm::pi(); float result = 0.f; const std::clock_t timestamp1 = std::clock(); for (float i = begin; i(time_fast)); std::printf("sin Time %d clocks\n", static_cast(time_default)); return time_fast < time_default ? 0 : 1; } } namespace fastTan{ int perf() { const float begin = -glm::pi(); const float end = glm::pi(); float result = 0.f; const std::clock_t timestamp1 = std::clock(); for (float i = begin; i(time_fast)); std::printf("tan Time %d clocks\n", static_cast(time_default)); return time_fast < time_default ? 0 : 1; } } int main() { int Error(0); Error += ::fastCos::perf(); Error += ::fastSin::perf(); Error += ::fastTan::perf(); return Error; }