diff options
Diffstat (limited to 'tests/test6')
-rwxr-xr-x | tests/test6/compil.sh | 1 | ||||
-rw-r--r-- | tests/test6/test6.c | 23 |
2 files changed, 22 insertions, 2 deletions
diff --git a/tests/test6/compil.sh b/tests/test6/compil.sh index 4ac3ca3..2e49576 100755 --- a/tests/test6/compil.sh +++ b/tests/test6/compil.sh @@ -1 +1,2 @@ +#!/bin/bash -xe gcc -Wall -g -o test6 test6.c -lm diff --git a/tests/test6/test6.c b/tests/test6/test6.c index 3a78c0c..2cb7074 100644 --- a/tests/test6/test6.c +++ b/tests/test6/test6.c @@ -1,5 +1,6 @@ #include <math.h> #include <stdio.h> +#include <stdlib.h> //#if 1 //(UGLY_IEEE754_FLOAT32_HACK :-) /* @@ -24,8 +25,7 @@ static inline float todB_a2(const float *x){ } //#endif - -int main() { +void test_todb_a() { float f, dbav[32]={0.f}, dbaf[32]={0.f}; int i=0; for(f=1024000.f;f>1.f;f/=2.f) { @@ -36,6 +36,25 @@ int main() { for (i=0;i<32;i++) printf("f==%f\tv==%f\n", dbaf[i], dbav[i]); +} + +void dump_testfile() { + int i,n; + float f[256]; + FILE *fh=fopen("./test.raw", "r"); + if (fh==NULL) return; + while ( (n=fread(f, sizeof(float), 256, fh)) > 0 ) { + for(i=0;i<n;i++) { + printf("%+.3f\t", f[i]); + } + } + fclose(fh); +} + +int main() { + //test_todb_a(); + dump_testfile(); + return 0; } |