wrap~ (Was: Re: [PD] wave morphing)
Denis Trapeznikoff
denissimo at gmail.com
Wed Jan 31 18:40:08 CET 2007
Sorry, "reply" instead of "reply all" again.
Well, it seemed impossible to me, but here what I found in d_math.c (pd
0.40.0 or something, I'm a bit lazy to look for version):
static t_int *sigwrap_perform(t_int *w)
{
float *in = *(t_float **)(w+1), *out = *(t_float **)(w+2);
t_int n = *(t_int *)(w+3);
while (n--)
{
float f = *in++;
int k = f;
if (f > 0) *out++ = f-k;
else *out++ = f - (k-1);
}
return (w + 4);
}
Here it definitely says:
if f <= 0 then return f - ((int f) - 1) = f - (int f) + 1 = frac(f) + 1
which is 1 for each non-positive int, of course, and assumes float-to-int
conversions (int k = f) take 'neares to zero' which seems a dangerous
assumption for me (I guess, it should return frac(f) + 1, where 0<=frac<1
for each negative number; perhaps, some compiler flags fix it, it depends on
compiler, but for integers the result is always 1).
I think, the whole situation is worthy a bug report.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20070131/cae9da1d/attachment.htm>
More information about the Pd-list
mailing list