Hi,

In principle, the problem should be solved in version 2.8.6. We have now a
pass of explicit casting before any optimization. This should prevent the
inadvertent mixing of integer and floating expressions during the
optimization phase. But more tests are welcome...

Cheers

Yann


-------------------------

Yann Orlarey
Directeur scientifique
www.grame.fr




Le sam. 25 août 2018 à 01:16, yann orlarey <orla...@gmail.com> a écrit :

> Hi,
>
> That's clearly a bug. Thanks Oleg for discovering the problem. I will have
> a look asap...
>
> Yann
>
> Le ven. 24 août 2018 à 16:30, Oleg Nesterov <o...@redhat.com> a écrit :
>
>> On 08/24, Julius Smith wrote:
>> >
>> > I think this one may have been fixed. I cannot reproduce it in the
>> > latest git master-dev branch:
>>
>> I am on master-dev too,
>>
>> > faust -v
>> > FAUST : DSP to C, C++, Java, JavaScript, old C++, asm.js, WebAssembly
>> > (wast/wasm) compiler, Version 2.8.1
>>
>>
>> FAUST : DSP to C, C++, Java, JavaScript, old C++, asm.js, WebAssembly
>> (wast/wasm) compiler, Version 2.8.3
>> > noise = random / RANDMAX
>> > with{
>> > mask = 4294967295; // 2^32-1
>> > random = +(12345) ~ *(1103515245) & mask; // "linear congruential"
>> > RANDMAX = 2147483647.0; // = 2^31-1 = MAX_SIGNED_INT in 32 bits
>> > };
>>
>> $ cat /tmp/bug.dsp
>>
>>         noise = random / RANDMAX
>>         with{
>>         mask = 4294967295; // 2^32-1
>>         random = +(12345) ~ *(1103515245) & mask; // "linear congruential"
>>         RANDMAX = 2147483647.0; // = 2^31-1 = MAX_SIGNED_INT in 32 bits
>>         };
>>
>>         process = noise <: *;
>>
>> $ faust -a plot.cpp /tmp/bug.dsp
>>
>>         virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT**
>> outputs) {
>>                 FAUSTFLOAT* output0 = outputs[0];
>>                 for (int i = 0; (i < count); i = (i + 1)) {
>>                         iRec0[0] = ((1103515245 * iRec0[1]) + 12345);
>>                         output0[i] = FAUSTFLOAT((2.16840434e-19f *
>> float(mydsp_faustpower2_i(iRec0[0]))));
>>                         iRec0[1] = iRec0[0];
>>
>>                 }
>>
>>         }
>>
>> mydsp_faustpower2_i(iRec0[0]) is wrong.
>>
>> $ /tmp/bug-plot
>>
>>         0.000000
>>         0.000000
>>         0.000000
>>         -0.000000
>>         -0.000000
>>         0.000000
>>         -0.000000
>>         0.000000
>>         -0.000000
>>         -0.000000
>>         -0.000000
>>         -0.000000
>>         0.000000
>>         -0.000000
>>         0.000000
>>         -0.000000
>>
>>
>> > Maybe the ".0" at the end of RANDMAX is new?
>>
>> I don't think it should make any difference... just note the comment
>>
>>         // special handling for division, we always want a float division
>>
>> in generateBinOp().
>>
>> 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
>
_______________________________________________
Faudiostream-users mailing list
Faudiostream-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/faudiostream-users

Reply via email to