projects
/
aubio.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5f4fd2f
)
src/aubio_priv.h: IS_DENORMAL also for negative ones, CEIL_DENORMAL for anything...
author
Paul Brossier
<piem@piem.org>
Sun, 11 Oct 2009 10:32:05 +0000
(12:32 +0200)
committer
Paul Brossier
<piem@piem.org>
Sun, 11 Oct 2009 10:32:05 +0000
(12:32 +0200)
src/aubio_priv.h
patch
|
blob
|
history
diff --git
a/src/aubio_priv.h
b/src/aubio_priv.h
index
ab95042
..
096828b
100644
(file)
--- a/
src/aubio_priv.h
+++ b/
src/aubio_priv.h
@@
-197,10
+197,14
@@
typedef enum {
#define VERY_SMALL_NUMBER 2.e-42 //1.e-37
#define VERY_SMALL_NUMBER 2.e-42 //1.e-37
-#define IS_DENORMAL(f) f < VERY_SMALL_NUMBER
+/** if ABS(f) < VERY_SMALL_NUMBER, returns 1, else 0 */
+#define IS_DENORMAL(f) ABS(f) < VERY_SMALL_NUMBER
+/** if ABS(f) < VERY_SMALL_NUMBER, returns 0., else f */
#define KILL_DENORMAL(f) IS_DENORMAL(f) ? 0. : f
#define KILL_DENORMAL(f) IS_DENORMAL(f) ? 0. : f
-#define CEIL_DENORMAL(f) IS_DENORMAL(f) ? VERY_SMALL_NUMBER : f
+
+/** if f > VERY_SMALL_NUMBER, returns f, else returns VERY_SMALL_NUMBER */
+#define CEIL_DENORMAL(f) f < VERY_SMALL_NUMBER ? VERY_SMALL_NUMBER : f
#define SAFE_LOG10(f) LOG10(CEIL_DENORMAL(f))
#define SAFE_LOG(f) LOG(CEIL_DENORMAL(f))
#define SAFE_LOG10(f) LOG10(CEIL_DENORMAL(f))
#define SAFE_LOG(f) LOG(CEIL_DENORMAL(f))