Commit 952e0be7 authored by Andreas Zwinkau's avatar Andreas Zwinkau
Browse files

Test case for historical reasons

[r22410]
parent 98b744de
/**
* magical invsqrt function from Quake III code
* see: http://www.codemaestro.com/reviews/9
*/
float InvSqrt(float x)
{
float xhalf = 0.5f*x;
int i = *(int*)&x;
i = 0x5f3759df - (i>>1);
x = *(float*)&i;
x = x*(1.5f-xhalf*x*x);
return x;
}
int main(void) {
int result = InvSqrt(0.00056);
printf("Result: %d (should be 42)", result);
return result != 42;
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment