From 88f174d0b8b749cf96a38e284f266d3bdaa55ef4 Mon Sep 17 00:00:00 2001 From: Ludovic Pouzenc Date: Sun, 10 Jun 2012 20:22:56 +0000 Subject: Bon, on reprends à plat les problèmes de maths avec des fichiers en entrée pour valider tutes les étapes... MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: file:///var/svn/2012-violon-leds/trunk@16 6be1fa4d-33ac-4c33-becc-79fcb3794bb6 --- tests/test6/compil.sh | 1 + tests/test6/test6.c | 23 +++++++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) (limited to 'tests/test6') 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 #include +#include //#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