Thanks, Charles, For Windows, I found int _isnan(double x) in float.h; it returns non-zero if x is NaN. Also in float.h, int _finite(double x) returns zero if the number is +- infinite or a NaN, so that would seem to cover every possibility. and int _fpclass(double x) returns a specific code for each type of NaN as well as zero and non-zero numbers. There don't seem to be any float versions of these. If the overhead is not too high it would make sense to use one of these in any dsp routine that might generate such values. Ideally it should be on the input to [dac~] so it only needs to be called once per sample, but I'll try it on sqosc~ to see what happens...
Martin
Charles Henry wrote:
okay, (on linux) you find math.h in /usr/include/ which includes a file /usr/include/bits/mathcalls.h there are three functions int finite(double x) -- returns 1, if x is not NaN or inf int isinf(double x) -- returns 1, if x is inf or -inf int isnan(double x) -- returns 1, if x is NaN
int finitef(float x), int isnanf(float x), and int isinff(float x) are the float versions.
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list