Skip to content

Instantly share code, notes, and snippets.

@haxpor
Last active April 18, 2019 19:12
Show Gist options
  • Save haxpor/8a438a9a2cf16852b2f9d2c932b7b3ca to your computer and use it in GitHub Desktop.
Save haxpor/8a438a9a2cf16852b2f9d2c932b7b3ca to your computer and use it in GitHub Desktop.
test case to test glm_vec4_distance running on Android device (armv7 or 8 capable) according to issue #82 of cglm on github
CGLM_ALIGN(16) vec4 v1;
CGLM_ALIGN(16) vec4 v2;
float d1, d2;
for (int i=0; i<1000; ++i)
{
test_rand_vec4(v1);
test_rand_vec4(v2);
d1 = glm_vec4_distance(v1, v2);
d2 = sqrtf(powf(v1[0]-v2[0], 2.0f) + pow(v1[1]-v2[1], 2.0f) + pow(v1[2]-v2[2], 2.0f) + pow(v1[3]-v2[3], 2.0f));
if (fabsf(d1 - d2) > 0.000009)
{
KRR_LOGE("test %d failed", i);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment