mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-11-15 05:48:33 +00:00
update to snapshot spandsp-20080916.tar.gz
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9769 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
1 parent
e503aa41d7
commit
7460c20ecd
17 files changed
+538
-208
No files matched your search
@@ -22,7 +22,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: vector_float_tests.c,v 1.9 2008/05/13 13:17:27 steveu Exp $
|
||||
* $Id: vector_float_tests.c,v 1.10 2008/09/16 15:21:52 steveu Exp $
|
||||
*/
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
@@ -49,26 +49,82 @@ static double vec_dot_prod_dumb(const double x[], const double y[], int n)
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
static int test_vec_dot_prod(void)
|
||||
{
|
||||
int i;
|
||||
double x[100];
|
||||
double y[100];
|
||||
double zsa;
|
||||
double zsb;
|
||||
double ratio;
|
||||
|
||||
for (i = 0; i < 99; i++)
|
||||
{
|
||||
x[i] = rand();
|
||||
y[i] = rand();
|
||||
}
|
||||
zsa = vec_dot_prod(x, y, 99);
|
||||
zsb = vec_dot_prod_dumb(x, y, 99);
|
||||
if (zsa != zsb)
|
||||
for (i = 1; i < 99; i++)
|
||||
{
|
||||
printf("Tests failed\n");
|
||||
exit(2);
|
||||
zsa = vec_dot_prod(x, y, i);
|
||||
zsb = vec_dot_prod_dumb(x, y, i);
|
||||
ratio = zsa/zsb;
|
||||
if (ratio < 0.9999 || ratio > 1.0001)
|
||||
{
|
||||
printf("vec_dot_prod() - %f %f\n", zsa, zsb);
|
||||
printf("Tests failed\n");
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
static float vec_dot_prodf_dumb(const float x[], const float y[], int n)
|
||||
{
|
||||
int i;
|
||||
float z;
|
||||
|
||||
z = 0.0;
|
||||
for (i = 0; i < n; i++)
|
||||
z += x[i]*y[i];
|
||||
return z;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
static int test_vec_dot_prodf(void)
|
||||
{
|
||||
int i;
|
||||
float x[100];
|
||||
float y[100];
|
||||
float zsa;
|
||||
float zsb;
|
||||
float ratio;
|
||||
|
||||
for (i = 0; i < 99; i++)
|
||||
{
|
||||
x[i] = rand();
|
||||
y[i] = rand();
|
||||
}
|
||||
for (i = 1; i < 99; i++)
|
||||
{
|
||||
zsa = vec_dot_prodf(x, y, i);
|
||||
zsb = vec_dot_prodf_dumb(x, y, i);
|
||||
ratio = zsa/zsb;
|
||||
if (ratio < 0.9999f || ratio > 1.0001f)
|
||||
{
|
||||
printf("vec_dot_prodf() - %e %e\n", zsa, zsb);
|
||||
printf("Tests failed\n");
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
test_vec_dot_prod();
|
||||
test_vec_dot_prodf();
|
||||
|
||||
printf("Tests passed.\n");
|
||||
return 0;
|
||||
|
||||
Reference in new issue
Block a user