Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Opus
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alexander Traud
Opus
Commits
92518982
Commit
92518982
authored
17 years ago
by
Jean-Marc Valin
Browse files
Options
Downloads
Patches
Plain Diff
Added mathops-test
parent
9d5b4a6f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/Makefile.am
+3
-2
3 additions, 2 deletions
tests/Makefile.am
tests/mathops-test.c
+63
-0
63 additions, 0 deletions
tests/mathops-test.c
with
66 additions
and
2 deletions
tests/Makefile.am
+
3
−
2
View file @
92518982
INCLUDES
=
-I
$(
top_srcdir
)
/libcelt
METASOURCES
=
AUTO
TESTS
=
type-test ectest cwrs32-test cwrs64-test real-fft-test dft-test laplace-test mdct-test rotation-test
TESTS
=
type-test ectest cwrs32-test cwrs64-test real-fft-test dft-test laplace-test mdct-test rotation-test
mathops-test
noinst_PROGRAMS
=
type-test ectest cwrs32-test cwrs64-test real-fft-test dft-test laplace-test mdct-test rotation-test
noinst_PROGRAMS
=
type-test ectest cwrs32-test cwrs64-test real-fft-test dft-test laplace-test mdct-test rotation-test
mathops-test
type_test_SOURCES
=
type-test.c
ectest_SOURCES
=
ectest.c
...
...
@@ -14,6 +14,7 @@ dft_test_SOURCES = dft-test.c
laplace_test_SOURCES
=
laplace-test.c
mdct_test_SOURCES
=
mdct-test.c
rotation_test_SOURCES
=
rotation-test.c
mathops_test_SOURCES
=
mathops-test.c
LDFLAGS
=
-static
LDADD
=
$(
top_builddir
)
/libcelt/libcelt.la
This diff is collapsed.
Click to expand it.
tests/mathops-test.c
0 → 100644
+
63
−
0
View file @
92518982
#ifdef HAVE_CONFIG_H
#include
"config.h"
#endif
#include
"mathops.h"
#include
<stdio.h>
#include
<math.h>
#ifdef FIXED_POINT
#define WORD "%d"
#else
#define WORD "%f"
#endif
int
ret
=
0
;
void
testdiv
()
{
celt_int32_t
i
;
for
(
i
=-
327670
;
i
<=
327670
;
i
++
)
{
double
prod
;
celt_word32_t
val
;
if
(
i
==
0
)
continue
;
val
=
celt_rcp
(
i
);
#ifdef FIXED_POINT
prod
=
(
1
.
/
32768
.
/
65526
.)
*
val
*
i
;
#else
prod
=
val
*
i
;
#endif
if
(
fabs
(
prod
-
1
)
>
.
001
)
{
fprintf
(
stderr
,
"div failed: 1/%d="
WORD
" (product = %f)
\n
"
,
i
,
val
,
prod
);
ret
=
1
;
}
}
}
void
testsqrt
()
{
celt_int32_t
i
;
for
(
i
=
1
;
i
<=
1000000000
;
i
++
)
{
double
ratio
;
celt_word16_t
val
;
val
=
celt_sqrt
(
i
);
ratio
=
val
/
sqrt
(
i
);
if
(
fabs
(
ratio
-
1
)
>
.
001
&&
fabs
(
val
-
sqrt
(
i
))
>
2
)
{
fprintf
(
stderr
,
"sqrt failed: sqrt(%d)="
WORD
" (ratio = %f)
\n
"
,
i
,
val
,
ratio
);
ret
=
1
;
}
i
+=
i
>>
10
;
}
}
int
main
()
{
testdiv
();
testsqrt
();
return
0
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment