[PD] removing NaN pure-pd
czhenry at gmail.com
Wed Oct 29 22:29:48 CET 2008
On Wed, Oct 29, 2008 at 2:03 PM, Martin Peach <martin.peach at sympatico.ca> wrote:
> In the perform routine of sqosc~, I used:
> if (finite(sample))*out++ = sample;
> else *out++ = 0.0;
> to get rid of denormals.
> For MSW builds that required adding:
> #include <float.h> /* for _finite */
> #define finite _finite
> Seems like the simplest solution to me...
It might be simplest, but it's very inefficient. Consider if all pd
objects had to check every sample to see that it's a number....
NaN and inf should be fairly rare occurrences. No sense adding more
instructions to cover the mere possibility of something going
wrong--an interrupt/signal based solution would add less cost to the
program, if it's possible.
But where would such a signal handler be declared (my guess is
m_pd.h)? Would everything need to be compiled with the added flag(s)
(my guess is yes)? Would there be variations across platforms (no
More information about the Pd-list