For example, this program process = no.noise <: *(mem);
outputs zeroes due to integer overflow. process = no.noise <: *; the same. This one works correctly process = no.noise : ^(2); ------------------------------------------------------------------------------- I think this is because something like (float1 * int1) * (float2 * int2) can be normalized to, say, float1 * (float2 * (int1 * (int2))) mterm::operator*=(Tree t) simply does if (isSigBinOp(t, &op, x, y) && (op == kMul)) { *this *= x; // float2 *this *= y; // int2 } and in general after that nothing can tell that int2 should be promoted to real. generateBinOp() does promote2real() if (t1 == kReal) || (t2 == kReal), but in the case above we will have float(int1 * int2) and this can overflow. Consider this trivial program: sig1 = int : *(2.0); sig2 = int : *(3.0); process = sig1 * sig2; it compiles into output0[i] = FAUSTFLOAT((6.0f * float((int(float(input1[i])) * int(float(input0[i])))))); and this is obviously wrong. sig1 = int : *(2.0); process = sig1 <: *; results in output0[i] = FAUSTFLOAT((4.0f * float(mydsp_faustpower2_i(int(float(input0[i])))))); which is equally wrong, the same problem. Just in case... this is not because of mterm.fCoef logic. Say, process = int * ffunction(float f(), <math.h>, "") <: *; results in output0[i] = FAUSTFLOAT((mydsp_faustpower2_f(float(f())) * float(mydsp_faustpower2_i(int(float(input0[i])))))); ------------------------------------------------------------------------------- At the same, sig1 = int : *(2.0) : float; sig2 = int : *(3.0) : float; process = sig1 * sig2; fixes the problem but output0[i] = FAUSTFLOAT(((3.0f * float(int(float(input1[i])))) * (2.0f * float(int(float(input0[i])))))); is suboptimal. In fact sigFloatCast() can "confuse" faust very easily, sig = *(2.0) : float; process = sig * 3.0; leads to output0[i] = FAUSTFLOAT((3.0f * (2.0f * float(input0[i])))); perhaps operator*() could me more clever if isSigXxxCast(t) ... Oleg. ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Faudiostream-users mailing list Faudiostream-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/faudiostream-users