From dac77d134471a02a4d5b8260650882b2a7517a83 Mon Sep 17 00:00:00 2001 From: Jean-Marc Valin <jean-marc.valin@usherbrooke.ca> Date: Fri, 5 Aug 2011 10:53:04 -0400 Subject: [PATCH] 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 --- libcelt/tests/mathops-test.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libcelt/tests/mathops-test.c b/libcelt/tests/mathops-test.c index efe805370..56ac5b769 100644 --- a/libcelt/tests/mathops-test.c +++ b/libcelt/tests/mathops-test.c @@ -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; } } -- GitLab