diff options
author | Katja <katjav@users.sourceforge.net> | 2011-11-06 14:41:44 +0000 |
---|---|---|
committer | Katja <katjav@users.sourceforge.net> | 2011-11-06 14:41:44 +0000 |
commit | 4f1ee28d687d583601d41ff58e1618b381d2675f (patch) | |
tree | eb9df33c9928ec11de287a1d70ec714c9a3b9f7c /modules/cmath~.c | |
parent | 4a05094c9a009707674c079c0481eaf8e1f8490f (diff) |
made creb compliant with double precision
- changed float to t_float
- adapted subnormal detection
svn path=/trunk/externals/creb/; revision=15706
Diffstat (limited to 'modules/cmath~.c')
-rw-r--r-- | modules/cmath~.c | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/modules/cmath~.c b/modules/cmath~.c index 5526b9f..85db447 100644 --- a/modules/cmath~.c +++ b/modules/cmath~.c @@ -33,19 +33,19 @@ typedef struct cmath static t_int *cmath_perform_clog(t_int *w) { - t_float *inx = (float *)(w[2]); - t_float *iny = (float *)(w[3]); - t_float *outx = (float *)(w[5]); // clockwize addressing - t_float *outy = (float *)(w[4]); + t_float *inx = (t_float *)(w[2]); + t_float *iny = (t_float *)(w[3]); + t_float *outx = (t_float *)(w[5]); // clockwize addressing + t_float *outy = (t_float *)(w[4]); t_int i; t_int n = (t_int)(w[1]); t_float x; while (n--){ - float x = *inx++; - float y = *iny++; - float norm = sqrt(x*x + y*y); - float arg = atan2(y, x); + t_float x = *inx++; + t_float y = *iny++; + t_float norm = sqrt(x*x + y*y); + t_float arg = atan2(y, x); if (norm < MINNORM){ norm = MINNORM; } @@ -59,18 +59,18 @@ static t_int *cmath_perform_clog(t_int *w) static t_int *cmath_perform_cexp(t_int *w) { - t_float *inx = (float *)(w[2]); - t_float *iny = (float *)(w[3]); - t_float *outx = (float *)(w[5]); // clockwize addressing - t_float *outy = (float *)(w[4]); + t_float *inx = (t_float *)(w[2]); + t_float *iny = (t_float *)(w[3]); + t_float *outx = (t_float *)(w[5]); // clockwize addressing + t_float *outy = (t_float *)(w[4]); t_int i; t_int n = (t_int)(w[1]); t_float x; while (n--){ - float x = *inx++; - float y = *iny++; - float norm = exp(x); + t_float x = *inx++; + t_float y = *iny++; + t_float norm = exp(x); *outx++ = norm * cos(y); *outy++ = norm * sin(y); } @@ -80,20 +80,20 @@ static t_int *cmath_perform_cexp(t_int *w) static t_int *cmath_perform_nfft(t_int *w) { - t_float *inx = (float *)(w[2]); - t_float *iny = (float *)(w[3]); - t_float *outx = (float *)(w[5]); // clockwize addressing - t_float *outy = (float *)(w[4]); + t_float *inx = (t_float *)(w[2]); + t_float *iny = (t_float *)(w[3]); + t_float *outx = (t_float *)(w[5]); // clockwize addressing + t_float *outy = (t_float *)(w[4]); t_int i; t_int n = (t_int)(w[1]); t_float x; - t_float scale = 1.0f / (sqrt((float)n)); + t_float scale = 1.0 / (sqrt((t_float)n)); mayer_fft(n, inx, outx); while (n--){ - float x = *inx++; - float y = *iny++; + t_float x = *inx++; + t_float y = *iny++; *outx++ = scale * x; *outy++ = scale * y; } @@ -103,20 +103,20 @@ static t_int *cmath_perform_nfft(t_int *w) static t_int *cmath_perform_nifft(t_int *w) { - t_float *inx = (float *)(w[2]); - t_float *iny = (float *)(w[3]); - t_float *outx = (float *)(w[5]); // clockwize addressing - t_float *outy = (float *)(w[4]); + t_float *inx = (t_float *)(w[2]); + t_float *iny = (t_float *)(w[3]); + t_float *outx = (t_float *)(w[5]); // clockwize addressing + t_float *outy = (t_float *)(w[4]); t_int i; t_int n = (t_int)(w[1]); t_float x; - t_float scale = 1.0f / (sqrt((float)n)); + t_float scale = 1.0 / (sqrt((t_float)n)); mayer_ifft(n, inx, outx); while (n--){ - float x = *inx++; - float y = *iny++; + t_float x = *inx++; + t_float y = *iny++; *outx++ = scale * x; *outy++ = scale * y; } |