| I see, thanks for the info! Maybe this could be added to the documentation:)
Søren
On 12/30/20, Eduardo Moguillansky wrote:
> That's not a bug with int but a misconception as to how a float works in
> c which is the underlying representation. 3.01 is represented actually
> as 3.009999999999999787, so when multiplied by 100 it is slightly less
> than 1 and int truncates it to 0. Instead of using int, use round or
> int(frac(p1)*100 + 0.01)
>
> On 30.12.20 11:00, Søren Jakobsen wrote:
>> I wonder if the following is a bug, or I somehow misunderstood something?
>>
>>
>>
>> -o dac
>>
>>
>> instr 3
>> ii = int(frac(p1) * 100)
>> print ii ; would expect '1' but getting '0'
>> endin
>>
>>
>> i 3.01 0 0
>>
>>
>>
>> Csound mailing list
>> Csound@listserv.heanet.ie
>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>> Send bugs reports to
>> https://github.com/csound/csound/issues
>> Discussions of bugs and features can be posted here
>
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
> https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
>
Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here |