Re: [Faudiostream-users] When do int or float numerical entries make a difference?
Done. Stéphane > Le 12 févr. 2021 à 14:57, Till Bovermann a écrit : > > Dear Stéphane, all, > > (to be super-nit-picky...) > > At the given link [1], it states that > > \forall t \in |N, y(t) = 0.95 > > shouldn't that be > > \forall t \in |N^+, y(t) = 0.95 > > > Note the plus sign, which excludes negative t's for which y(t) = 0. > This seems to me a rather important element of the faust language (e.g. used > in the famous "dirac" implementation `d = 1-1;') > > cheers > Till > > > > [1] https://faustdoc.grame.fr/manual/syntax/#numbers > > > > >> On 8. Feb 2021, at 19:33, Stéphane Letz wrote: >> >> The ‘pow' operation computed on integer arguments was indeed incorrect at >> compile time. Should be fixed in 2.30.12 version on master-dev. >> >> The documentation has been completed for numbers: >> https://faustdoc.grame.fr/manual/syntax/#numbers >> >> Stéphane >> >> >>> Le 8 févr. 2021 à 00:11, Dario Sanfilippo a >>> écrit : >>> >>> Thanks, Oleg. And sorry if I was a little lazy. :-) >>> >>> I see that 2^32 gives 4.2949673e+09 as well; shouldn't we have the same >>> behaviour between a signal and its delayed version? >>> >>> Dario >>> >>> On Sun, 7 Feb 2021 at 20:26, Oleg Nesterov wrote: >>> On 02/07, Dario Sanfilippo wrote: Other than that, can you tell why -2 or 2 is producing -inf? >>> >>> Runtime integer overflow, I guess. Why didn't you try to simplify >>> your code ? ;) >>> >>> Consider >>> >>> process = 2.0', 2' : par( i, 2, ^(32)); >>> >>> output: >>> >>> 0 0 >>> 4.2949673e+09 0 >>> ... >>> >>> >>> this means that >>> >>> process = 2.0', 2' : par( i, 2, 1/^(32)); >>> >>> outputs >>> >>> inf inf >>> 2.32830644e-10 inf >>> ... >>> >>> Oleg. >>> >>> >>> >>> -- >>> Dr Dario Sanfilippo >>> http://dariosanfilippo.com >>> ___ >>> 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 > ___ Faudiostream-users mailing list Faudiostream-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/faudiostream-users
Re: [Faudiostream-users] When do int or float numerical entries make a difference?
Dear Stéphane, all, (to be super-nit-picky...) At the given link [1], it states that \forall t \in |N, y(t) = 0.95 shouldn't that be \forall t \in |N^+, y(t) = 0.95 Note the plus sign, which excludes negative t's for which y(t) = 0. This seems to me a rather important element of the faust language (e.g. used in the famous "dirac" implementation `d = 1-1;') cheers Till [1] https://faustdoc.grame.fr/manual/syntax/#numbers > On 8. Feb 2021, at 19:33, Stéphane Letz wrote: > > The ‘pow' operation computed on integer arguments was indeed incorrect at > compile time. Should be fixed in 2.30.12 version on master-dev. > > The documentation has been completed for numbers: > https://faustdoc.grame.fr/manual/syntax/#numbers > > Stéphane > > >> Le 8 févr. 2021 à 00:11, Dario Sanfilippo a >> écrit : >> >> Thanks, Oleg. And sorry if I was a little lazy. :-) >> >> I see that 2^32 gives 4.2949673e+09 as well; shouldn't we have the same >> behaviour between a signal and its delayed version? >> >> Dario >> >> On Sun, 7 Feb 2021 at 20:26, Oleg Nesterov wrote: >> On 02/07, Dario Sanfilippo wrote: >>> >>> Other than that, can you tell why -2 or 2 is producing -inf? >> >> Runtime integer overflow, I guess. Why didn't you try to simplify >> your code ? ;) >> >> Consider >> >>process = 2.0', 2' : par( i, 2, ^(32)); >> >> output: >> >>0 0 >>4.2949673e+09 0 >>... >> >> >> this means that >> >>process = 2.0', 2' : par( i, 2, 1/^(32)); >> >> outputs >> >>inf inf >>2.32830644e-10 inf >>... >> >> Oleg. >> >> >> >> -- >> Dr Dario Sanfilippo >> http://dariosanfilippo.com >> ___ >> 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 -- Till Bovermann https://tai-studio.org | http://lfsaw.de | https://www.instagram.com/_lfsaw/ ___ Faudiostream-users mailing list Faudiostream-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/faudiostream-users
Re: [Faudiostream-users] When do int or float numerical entries make a difference?
Indeed, the compiler is full of « not correctly solved corner-cases » ((-; You’ve found many, Dario also. They are probably still a lot we are even not aware of. We try to prioritise what we can possibly fix in a reasonable time, since some other much mode interesting developments take our time.. Guys if you can recrut an army of compiler competent developers, we would be interested… In the meantime having an extensive list of all the issues you have discovered can help ! Thanks. Stéphane > Le 8 févr. 2021 à 20:42, Oleg Nesterov a écrit : > > On 02/08, Stéphane Letz wrote: >> >> The ‘pow' operation computed on integer arguments was indeed incorrect at >> compile time. Should be fixed in 2.30.12 version on master-dev. > > commit bb0bf13334e9a1320f0f90b6ae56da277b9d96a5 adds > > +Type1 ipow(Type1 a, Type2 ex) > +{ > +if (0 == ex) return 1; > +else { > +Type1 z = a; > +Type1 y = 1; > +while (true) { > +if (ex & 1) y *= z; > +ex /= 2; > +if (0 == ex) break; > +z *= z; > +} > +return y; > +} > +} > > Perhaps this is what PowPrim::generateCode() should generate when arg1 is > int/const? > > Just look at the c++ code generated from > > process = ^(10); > > to me mydsp_faustpower10_f() makes no sense. > > --- > and to remind, > > process = 100; > > outputs 276447232 ;) > > IIRC, simply because faust uses atoi() without any check, but I am not sure. > > Oleg. > ___ Faudiostream-users mailing list Faudiostream-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/faudiostream-users
Re: [Faudiostream-users] When do int or float numerical entries make a difference?
On 02/08, Stéphane Letz wrote: > > The ‘pow' operation computed on integer arguments was indeed incorrect at > compile time. Should be fixed in 2.30.12 version on master-dev. commit bb0bf13334e9a1320f0f90b6ae56da277b9d96a5 adds +Type1 ipow(Type1 a, Type2 ex) +{ +if (0 == ex) return 1; +else { +Type1 z = a; +Type1 y = 1; +while (true) { +if (ex & 1) y *= z; +ex /= 2; +if (0 == ex) break; +z *= z; +} +return y; +} +} Perhaps this is what PowPrim::generateCode() should generate when arg1 is int/const? Just look at the c++ code generated from process = ^(10); to me mydsp_faustpower10_f() makes no sense. --- and to remind, process = 100; outputs 276447232 ;) IIRC, simply because faust uses atoi() without any check, but I am not sure. Oleg. ___ Faudiostream-users mailing list Faudiostream-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/faudiostream-users
Re: [Faudiostream-users] When do int or float numerical entries make a difference?
The ‘pow' operation computed on integer arguments was indeed incorrect at compile time. Should be fixed in 2.30.12 version on master-dev. The documentation has been completed for numbers: https://faustdoc.grame.fr/manual/syntax/#numbers Stéphane > Le 8 févr. 2021 à 00:11, Dario Sanfilippo a > écrit : > > Thanks, Oleg. And sorry if I was a little lazy. :-) > > I see that 2^32 gives 4.2949673e+09 as well; shouldn't we have the same > behaviour between a signal and its delayed version? > > Dario > > On Sun, 7 Feb 2021 at 20:26, Oleg Nesterov wrote: > On 02/07, Dario Sanfilippo wrote: > > > > Other than that, can you tell why -2 or 2 is producing -inf? > > Runtime integer overflow, I guess. Why didn't you try to simplify > your code ? ;) > > Consider > > process = 2.0', 2' : par( i, 2, ^(32)); > > output: > > 0 0 > 4.2949673e+09 0 > ... > > > this means that > > process = 2.0', 2' : par( i, 2, 1/^(32)); > > outputs > > inf inf > 2.32830644e-10 inf > ... > > Oleg. > > > > -- > Dr Dario Sanfilippo > http://dariosanfilippo.com > ___ > 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] When do int or float numerical entries make a difference?
Thanks, Oleg. And sorry if I was a little lazy. :-) I see that 2^32 gives 4.2949673e+09 as well; shouldn't we have the same behaviour between a signal and its delayed version? Dario On Sun, 7 Feb 2021 at 20:26, Oleg Nesterov wrote: > On 02/07, Dario Sanfilippo wrote: > > > > Other than that, can you tell why -2 or 2 is producing -inf? > > Runtime integer overflow, I guess. Why didn't you try to simplify > your code ? ;) > > Consider > > process = 2.0', 2' : par( i, 2, ^(32)); > > output: > > 0 0 > 4.2949673e+09 0 > ... > > > this means that > > process = 2.0', 2' : par( i, 2, 1/^(32)); > > outputs > > inf inf > 2.32830644e-10 inf > ... > > Oleg. > > -- Dr Dario Sanfilippo http://dariosanfilippo.com ___ Faudiostream-users mailing list Faudiostream-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/faudiostream-users
Re: [Faudiostream-users] When do int or float numerical entries make a difference?
On 02/07, Dario Sanfilippo wrote: > > Other than that, can you tell why -2 or 2 is producing -inf? Runtime integer overflow, I guess. Why didn't you try to simplify your code ? ;) Consider process = 2.0', 2' : par( i, 2, ^(32)); output: 0 0 4.2949673e+09 0 ... this means that process = 2.0', 2' : par( i, 2, 1/^(32)); outputs inf inf 2.32830644e-10 inf ... Oleg. ___ Faudiostream-users mailing list Faudiostream-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/faudiostream-users
[Faudiostream-users] When do int or float numerical entries make a difference?
Hello, list. I hope that you're having a nice Sunday. I have this function to approximate the dilogarithm function: import("stdfaust.lib"); Li2(N, x) = ba.if( x < -1, -1 * ma.PI ^ 2 / 6 - .5 * log(-x) ^ 2 - sum(i, N, 1 / ((i + 1) ^ 2 * x ^ (i + 1))), ba.if( abs(x) <= 1, sum(i, N, x ^ (i + 1) / (i + 1) ^ 2), ma.PI ^ 2 / 3 - .5 * log(x) ^ 2 - sum(i, N, 1 / ((i + 1) ^ 2 * x ^ (i + 1 ); process = -2.0', -1.5', -1.0', -.5', -.1', .1', .5', 1.0', 1.5', 2.0' : par( i, 10, Li2(50)); //process = -2', -1.5', -1.0', -.5', -.1', .1', .5', 1.0', 1.5', 2' : par(i, 10, Li2(50)); I am calling it with delayed values to avoid division by zero or NaN in the non-outputting branches. I noticed that if I call it with int values as you can see in the commented process, I get -inf for 2 and -2, whereas I get the correct values if I use float. Please try with: faust2csvplot -double test_Li2.dsp ./test_Li2 -n 1 -s 1 I am aware that the arguments of some functions that use pattern matching must be ints, but I was also convinced that all values in Faust are treated as floats with math functions. What is good practice for floats and ints? Should I explicitly always write 1.0 instead of 1 as if I'm writing C++? Other than that, can you tell why -2 or 2 is producing -inf? Thanks. -- Dr Dario Sanfilippo http://dariosanfilippo.com ___ Faudiostream-users mailing list Faudiostream-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/faudiostream-users