mirror of
https://github.com/g-truc/glm.git
synced 2024-11-22 17:04:35 +00:00
Added test for fastSin #231
This commit is contained in:
parent
ec513f4466
commit
46e61b4f07
@ -9,10 +9,29 @@
|
||||
|
||||
#include <glm/gtc/type_precision.hpp>
|
||||
#include <glm/gtx/fast_trigonometry.hpp>
|
||||
#include <glm/gtc/constants.hpp>
|
||||
|
||||
int test_fastSin()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
float DiffMax = 0.0f;
|
||||
for(std::size_t i = 0; i < 10000; ++i)
|
||||
{
|
||||
float angle = glm::pi<float>() * 2.0f / static_cast<float>(i + 1);
|
||||
float A = glm::sin(angle);
|
||||
float B = glm::fastSin(angle);
|
||||
DiffMax = glm::max(DiffMax, glm::abs(B - A));
|
||||
}
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
Error += test_fastSin();
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user