ref: 258195f8cf3aff3e626f5482e6a7a5c07f3e5692
parent: 17b7d66582512717bdc6f480456271eada25fd88
author: Paul Brossier <piem@piem.org>
date: Mon Sep 28 16:58:03 EDT 2009
src/aubio_priv.h: define VERY_SMALL_NUMBER here, add KILL_DENORMAL and CEIL_DENORMAL macros, SAFE_LOG10 and SAFE_LOG
--- a/src/aubio_priv.h
+++ b/src/aubio_priv.h
@@ -189,7 +189,15 @@
#define ELEM_SWAP(a,b) { register smpl_t t=(a);(a)=(b);(b)=t; }
-#define ISDENORMAL(f) f < 1.e-37
+#define VERY_SMALL_NUMBER 2.e-42 //1.e-37
+
+#define IS_DENORMAL(f) f < VERY_SMALL_NUMBER
+
+#define KILL_DENORMAL(f) IS_DENORMAL(f) ? 0. : f
+#define CEIL_DENORMAL(f) IS_DENORMAL(f) ? VERY_SMALL_NUMBER : f
+
+#define SAFE_LOG10(f) LOG10(CEIL_DENORMAL(f))
+#define SAFE_LOG(f) LOG(CEIL_DENORMAL(f))
#define UNUSED __attribute__((unused))
--- a/src/temporal/filter.c
+++ b/src/temporal/filter.c
@@ -44,7 +44,7 @@
y = f->y->data[i];
for (j = 0; j < in->length; j++) {
/* new input */
- if (ISDENORMAL(in->data[i][j])) {
+ if (IS_DENORMAL(in->data[i][j])) {
x[0] = y[0] = 0.;
} else {
x[0] = in->data[i][j];