Undenormalise


#1

Hi

As I was studying the audio code (specifically CombFilter), I noticed judicious use of the following macro:

#if (JUCE_INTEL && JUCE_32BIT) || defined (DOXYGEN) /** This macro can be applied to a float variable to check whether it contains a denormalised value, and to normalise it if necessary. On CPUs that aren't vulnerable to denormalisation problems, this will have no effect. */ #define JUCE_UNDENORMALISE(x) x += 1.0f; x -= 1.0f; #else #define JUCE_UNDENORMALISE(x) #endif

I didn’t quite get what was going on here so I searched around and educated myself on denormal floating point numbers:

http://ardour.org/node/139

So now I know what problem Jule’s macro is fixing but I don’t get how adding and subtracting 1.0 turns a denormal number into a normal one. Can someone enlighten me please?

Thanks!