shithub: opus

Download patch

ref: dac77d134471a02a4d5b8260650882b2a7517a83
parent: bf6a4e01b6f1281a4711f293ef0a415c209ff13b
author: Jean-Marc Valin <[email protected]>
date: Fri Aug 5 06:53:04 EDT 2011

Fixes the celt_exp2() test (not the function, the test itself)

Was previously testing only far on the negative side and using
the wrong scaling factor

--- a/libcelt/tests/mathops-test.c
+++ b/libcelt/tests/mathops-test.c
@@ -117,13 +117,13 @@
 void testexp2(void)
 {
    opus_val16 x;
-   for (x=-32768;x<-30720;x++)
+   for (x=-32768;x<15360;x++)
    {
-      float error1 = fabs(x/2048.0-(1.442695040888963387*log(celt_exp2(x)/65536.0)));
-      float error2 = fabs(exp(0.6931471805599453094*x/2048.0)-celt_exp2(x)/65536.0);
+      float error1 = fabs(x/1024.0-(1.442695040888963387*log(celt_exp2(x)/65536.0)));
+      float error2 = fabs(exp(0.6931471805599453094*x/1024.0)-celt_exp2(x)/65536.0);
       if (error1>0.0002&&error2>0.00004)
       {
-         fprintf (stderr, "celt_exp2 failed: x = "WORD", error1 = %f, error2 = %f\n", x,error1,error2);
+    	 fprintf (stderr, "celt_exp2 failed: x = "WORD", error1 = %f, error2 = %f\n", x,error1,error2);
          ret = 1;
       }
    }