Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mumble-voip/celt-0.7.0.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'tests/mathops-test.c')
-rw-r--r--tests/mathops-test.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/mathops-test.c b/tests/mathops-test.c
index dc208da..b7ffdac 100644
--- a/tests/mathops-test.c
+++ b/tests/mathops-test.c
@@ -53,9 +53,28 @@ void testsqrt(void)
}
}
+void testrsqrt(void)
+{
+ celt_int32_t i;
+ for (i=1;i<=2000000;i++)
+ {
+ double ratio;
+ celt_word16_t val;
+ val = celt_rsqrt(i);
+ ratio = val*sqrt(i)/32768;
+ if (fabs(ratio - 1) > .05)
+ {
+ fprintf (stderr, "sqrt failed: sqrt(%d)="WORD" (ratio = %f)\n", i, val, ratio);
+ ret = 1;
+ }
+ i+= i>>10;
+ }
+}
+
int main(void)
{
testdiv();
testsqrt();
+ testrsqrt();
return ret;
}