Fixes the celt_exp2() test (not the function, the test itself)
authorJean-Marc Valin <jean-marc.valin@usherbrooke.ca>
Fri, 5 Aug 2011 14:53:04 +0000 (10:53 -0400)
committerJean-Marc Valin <jean-marc.valin@usherbrooke.ca>
Fri, 5 Aug 2011 14:53:04 +0000 (10:53 -0400)
Was previously testing only far on the negative side and using
the wrong scaling factor

libcelt/tests/mathops-test.c

index efe8053..56ac5b7 100644 (file)
@@ -117,13 +117,13 @@ void testlog2(void)
 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;
       }
    }