Re: [Faudiostream-users] error: invalid operands to binary expression ('float' and 'float')
Hi, Please send me the DSP code, or even better a reduced DSP example that shows the problem. Stéphane > Le 31 déc. 2018 à 16:36, Mykle James Hansen a écrit : > > Hi, can I ask some advice? > > I’m trying to compile a 60-line Faust program into a standalone app, > but Faust is generating some code that won’t compile on my system. > The code tries to use a float as the argument to the modulo > operator (%), yielding the error message in the subject line. > Anybody seen this before? > > I’m experiencing this when I try to run faust2caqt — it dies with > a compiler error: > >> looper3.cpp:16736:56: error: invalid operands to binary expression ('float' >> and 'float') >>fRec4[0] = ((float(iSlow3) * (fRec1[0] + fRec4[1])) % >> fTemp2); >>~~~ ^ >> ~~ >> looper3.cpp:16737:42: error: invalid operands to binary expression ('float' >> and 'float') >>ftbl0[int((iTemp1?((fRec4[0] + -1.0f) % >> fTemp2):131071.0f))] = fRec0[1]; >> ~~ ^ ~~ >> > > But the problem's not just faust2caqt. Running just ‘faust looper3.dsp’ also > generates those lines. > > OTOH, I am able to run this same Faust program in FaustLive no > problem, and I can also run it in the online editor. > > I just pulled and built the latest Faust compiler (master branch) to see if > that would help, but that didn’t seem to make a change. > Any advice would be most appreciated. > > Yrs stumpedly, > -mykle- > > ___ > 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
Re: [Faudiostream-users] error: invalid operands to binary expression ('float' and 'float')
I don't think any C or C++ compiler can help here, because (according to a Web search just), the definition of % in the 98 standard is "(a/b)*b + a%b == a" instead of what we want "floor(a/b)*b + a%b == a". I would be in favor of a Faust-emitted incompatible operator overloading of % for floats and doubles "float operator%(const float&, const float&)" etc. On Tue, Jan 1, 2019 at 3:34 AM Mykle Hansen wrote: > > Thanks Julius, I see what you mean. It's just a bit tricky to do, > because this code is generated by the Faust compiler as part > of the faust2caqt script. It’s pretty awkward to fix the source code > and restart the script halfway through, tho I suppose it’s possible. > > I wonder if this is an issue with my compiler version. > I’m trying to use Apple LLVM version 7.3.0, on OS X 10.11.6. > > Are there C++ compilers that know to promote % to fmod() when float arguments > are present? > What’s the current recommended compiler for compiling Faust-generated source? > > Thanks, > -mykle- > > > > > On Dec 31, 2018, at 7:17 PM, Julius Smith wrote: > > > > Hi Mykle, > > > > I think the compiler means to convert % to fmod() for floating-point > > args. I suggest using fmod() explicitly in place of "%" in your > > source for now as a workaround. > > > - Julius > > > > On Mon, Dec 31, 2018 at 7:36 AM Mykle James Hansen wrote: > >> > >> Hi, can I ask some advice? > >> > >> I’m trying to compile a 60-line Faust program into a standalone app, > >> but Faust is generating some code that won’t compile on my system. > >> The code tries to use a float as the argument to the modulo > >> operator (%), yielding the error message in the subject line. > >> Anybody seen this before? > >> > >> I’m experiencing this when I try to run faust2caqt — it dies with > >> a compiler error: > >> > >>> looper3.cpp:16736:56: error: invalid operands to binary expression > >>> ('float' and 'float') > >>>fRec4[0] = ((float(iSlow3) * (fRec1[0] + > >>> fRec4[1])) % fTemp2); > >>> > >>> ~~~ ^ ~~ > >>> looper3.cpp:16737:42: error: invalid operands to binary expression > >>> ('float' and 'float') > >>>ftbl0[int((iTemp1?((fRec4[0] + -1.0f) % > >>> fTemp2):131071.0f))] = fRec0[1]; > >>> ~~ ^ ~~ > >>> > >> > >> But the problem's not just faust2caqt. Running just ‘faust looper3.dsp’ > >> also generates those lines. > >> > >> OTOH, I am able to run this same Faust program in FaustLive no > >> problem, and I can also run it in the online editor. > >> > >> I just pulled and built the latest Faust compiler (master branch) to see if > >> that would help, but that didn’t seem to make a change. > >> Any advice would be most appreciated. > >> > >> Yrs stumpedly, > >> -mykle- > >> > >> ___ > >> Faudiostream-users mailing list > >> Faudiostream-users@lists.sourceforge.net > >> https://lists.sourceforge.net/lists/listinfo/faudiostream-users > > > > > > > > -- > > > > Julius O. Smith III > > 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 -- Julius O. Smith III 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
Re: [Faudiostream-users] error: invalid operands to binary expression ('float' and 'float')
Thanks Julius, I see what you mean. It's just a bit tricky to do, because this code is generated by the Faust compiler as part of the faust2caqt script. It’s pretty awkward to fix the source code and restart the script halfway through, tho I suppose it’s possible. I wonder if this is an issue with my compiler version. I’m trying to use Apple LLVM version 7.3.0, on OS X 10.11.6. Are there C++ compilers that know to promote % to fmod() when float arguments are present? What’s the current recommended compiler for compiling Faust-generated source? Thanks, -mykle- > > On Dec 31, 2018, at 7:17 PM, Julius Smith wrote: > > Hi Mykle, > > I think the compiler means to convert % to fmod() for floating-point > args. I suggest using fmod() explicitly in place of "%" in your > source for now as a workaround. > - Julius > > On Mon, Dec 31, 2018 at 7:36 AM Mykle James Hansen wrote: >> >> Hi, can I ask some advice? >> >> I’m trying to compile a 60-line Faust program into a standalone app, >> but Faust is generating some code that won’t compile on my system. >> The code tries to use a float as the argument to the modulo >> operator (%), yielding the error message in the subject line. >> Anybody seen this before? >> >> I’m experiencing this when I try to run faust2caqt — it dies with >> a compiler error: >> >>> looper3.cpp:16736:56: error: invalid operands to binary expression ('float' >>> and 'float') >>>fRec4[0] = ((float(iSlow3) * (fRec1[0] + fRec4[1])) >>> % fTemp2); >>>~~~ >>> ^ ~~ >>> looper3.cpp:16737:42: error: invalid operands to binary expression ('float' >>> and 'float') >>>ftbl0[int((iTemp1?((fRec4[0] + -1.0f) % >>> fTemp2):131071.0f))] = fRec0[1]; >>> ~~ ^ ~~ >>> >> >> But the problem's not just faust2caqt. Running just ‘faust looper3.dsp’ >> also generates those lines. >> >> OTOH, I am able to run this same Faust program in FaustLive no >> problem, and I can also run it in the online editor. >> >> I just pulled and built the latest Faust compiler (master branch) to see if >> that would help, but that didn’t seem to make a change. >> Any advice would be most appreciated. >> >> Yrs stumpedly, >> -mykle- >> >> ___ >> Faudiostream-users mailing list >> Faudiostream-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/faudiostream-users > > > > -- > > Julius O. Smith III > 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] error: invalid operands to binary expression ('float' and 'float')
Hi, can I ask some advice? I’m trying to compile a 60-line Faust program into a standalone app, but Faust is generating some code that won’t compile on my system. The code tries to use a float as the argument to the modulo operator (%), yielding the error message in the subject line. Anybody seen this before? I’m experiencing this when I try to run faust2caqt — it dies with a compiler error: > looper3.cpp:16736:56: error: invalid operands to binary expression ('float' > and 'float') > fRec4[0] = ((float(iSlow3) * (fRec1[0] + fRec4[1])) % > fTemp2); > ~~~ ^ > ~~ > looper3.cpp:16737:42: error: invalid operands to binary expression ('float' > and 'float') > ftbl0[int((iTemp1?((fRec4[0] + -1.0f) % > fTemp2):131071.0f))] = fRec0[1]; >~~ ^ ~~ > But the problem's not just faust2caqt. Running just ‘faust looper3.dsp’ also generates those lines. OTOH, I am able to run this same Faust program in FaustLive no problem, and I can also run it in the online editor. I just pulled and built the latest Faust compiler (master branch) to see if that would help, but that didn’t seem to make a change. Any advice would be most appreciated. Yrs stumpedly, -mykle- ___ Faudiostream-users mailing list Faudiostream-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/faudiostream-users