Hi, Right, the compiler try to factorize a multiplication by 0 ! Another way to see the problem it to compare :
process= (_*cos(1/2*ma.PI)^3,_,_*cos(-1/2*ma.PI)^3); and process= (_*cos(1/2*ma.PI)^3,_,_*cos(-1/2*ma.PI)^3) :> _; in simple and double precision. Clearly, the factorization rule needs to be fixed Thanks for discovering the problem ! Yann Yann Orlarey Directeur scientifique www.grame.fr 2016-09-24 18:33 GMT+02:00 Julius Smith <j...@ccrma.stanford.edu>: > This looks like numerical failure in the optimization by the Faust > compiler. You can see it approaching this situation in the following > simplified case: > > process=(_*cos(ma.PI/2),_,_*cos(0-ma.PI/2)):>_; > > which compiles to > > output0[i] = (FAUSTFLOAT)(6.123234e-17f * (((1.633124e+16f * > (float)input1[i]) + (float)input0[i]) + (float)input2[i])); > > Since cos(PI/2) = 0, the input coefficients are approximately 0,1,0, > which become (numerically) eps,1,eps, where eps = 6.123234e-17f in > this particular case. Factoring out eps gives 1/eps for the > coefficient of input1, which became infinity in the previous example > (numerical bug... 1/eps should possibly go to MAX_FLOAT, but not inf). > If there were a third signal multiplied by eps, then this factoring > would save a multiply, but in this case there are two multiplies > either way. > > I would personally like to be able to set a magnitude threshold below > which numbers are flushed to zero. Then the compiler would see > coefficients (0,1,0) in this case and not try to factor out the 0. > > - Julius > > On Fri, Sep 23, 2016 at 7:26 AM, Stéphane Letz <l...@grame.fr> wrote: > > The generated C++ code is incorrect (see this "(inf.0f * > (float)input1[i]))) » subexpression), so probably a bug in the compiler. > > > > Stéphane > > > > > >> Le 23 sept. 2016 à 13:28, Pierre Lecomte <pierre.leco...@gadz.org> a > écrit : > >> > >> import("stdfaust.lib"); > >> process=(_*cos(1/2*ma.PI)^3,_,_*cos(-1/2*ma.PI)^3):>_; > > > > > > ------------------------------------------------------------ > ------------------ > > _______________________________________________ > > Faudiostream-users mailing list > > Faudiostream-users@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/faudiostream-users > > > > > > > > -- > Julius O. Smith III <j...@ccrma.stanford.edu> > Professor of Music and, by courtesy, Electrical Engineering > CCRMA, Stanford University > http://ccrma.stanford.edu/~jos/ > > ------------------------------------------------------------ > ------------------ > _______________________________________________ > Faudiostream-users mailing list > Faudiostream-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/faudiostream-users >
------------------------------------------------------------------------------
_______________________________________________ Faudiostream-users mailing list Faudiostream-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/faudiostream-users