Csound Csound-dev Csound-tekno Search About

[Csnd] Scientific notation and constants

Date2008-12-03 03:34
FromTobiah
Subject[Csnd] Scientific notation and constants
I created a function table definition using
a program.  Python went into scientific notation.

f1 0.0 65536.0 10.0 1.0 0.3 0.09 0.027 0.0081 0.00243 0.000729 0.0002187 6.561e-05 1.9683e-05 5.9049e-06

Csound didn't complain; I'm assuming it does the right thing?

Thanks,

Tobiah

Date2008-12-03 04:39
FromDave Seidel
Subject[Csnd] Re: Scientific notation and constants
I've had this happen before using Python (in the context of blue), and 
it created problems -- it wasn't in a table definition, it was somewhere 
else, can't remember the details right now.  I don't think Csound is 
actually interpreting that notation correctly, I think it's more likely 
parsing it naively and throwing away everything after the "e".  As I 
recall, I solved it by casting to floats to get it all to come out in a 
consistent format.

- Dave

Tobiah wrote:
> I created a function table definition using
> a program.  Python went into scientific notation.
> 
> f1 0.0 65536.0 10.0 1.0 0.3 0.09 0.027 0.0081 0.00243 0.000729 0.0002187 
> 6.561e-05 1.9683e-05 5.9049e-06
> 
> Csound didn't complain; I'm assuming it does the right thing?
> 
> Thanks,
> 
> Tobiah
> 
> 
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe 
> csound"
> 
> 


Date2008-12-03 04:43
From"Steven Yi"
Subject[Csnd] Re: Re: Scientific notation and constants
AttachmentsNone  

Date2008-12-03 05:19
Fromjpff@cs.bath.ac.uk
Subject[Csnd] Re: Re: Re: Scientific notation and constants
I can see no evidence from the sources that Csound accepts "scientific"
notation in orchestras.  May have missed it though.

gen23 reads scientific and so does score reading.

==John ff

> Really?  I thought Istvan had done work to support scientific notation
> in the parser a long while ago.  Well, you can always print in python
> using something like:
>
> print "%.8f"%(somenumber)
>
> At least, I think that should do it. =)
>
> steven
>



Date2008-12-03 08:32
FromErnesto Illescas-Pel‡áez
Subject[Csnd] Re: Re: Re: Scientific notation and constants
To avoid this problem, I use the 'decimal' module (see 
http://www.python.org/doc/2.5.2/lib/module-decimal.html). Take care of 
the fact that decimal processes strings (not ints, floats...)
I hope this helps.
Cheers,

Ernesto

Steven Yi wrote:
> Really?  I thought Istvan had done work to support scientific notation
> in the parser a long while ago.  Well, you can always print in python
> using something like:
>
> print "%.8f"%(somenumber)
>
> At least, I think that should do it. =)
>
> steven
>
> On Tue, Dec 2, 2008 at 8:39 PM, Dave Seidel  wrote:
>   
>> I've had this happen before using Python (in the context of blue), and it
>> created problems -- it wasn't in a table definition, it was somewhere else,
>> can't remember the details right now.  I don't think Csound is actually
>> interpreting that notation correctly, I think it's more likely parsing it
>> naively and throwing away everything after the "e".  As I recall, I solved
>> it by casting to floats to get it all to come out in a consistent format.
>>
>> - Dave
>>
>> Tobiah wrote:
>>     
>>> I created a function table definition using
>>> a program.  Python went into scientific notation.
>>>
>>> f1 0.0 65536.0 10.0 1.0 0.3 0.09 0.027 0.0081 0.00243 0.000729 0.0002187
>>> 6.561e-05 1.9683e-05 5.9049e-06
>>>
>>> Csound didn't complain; I'm assuming it does the right thing?
>>>
>>> Thanks,
>>>
>>> Tobiah
>>>
>>>
>>> Send bugs reports to this list.
>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>>> csound"
>>>
>>>
>>>       
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>> csound"
>>
>>     
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>
>   

Date2008-12-03 16:17
FromDavid Mooney/Maxine Heller
Subject[Csnd] Re: Re: Re: Re: Scientific notation and constants
Speaking of decimal mode, I thought I saw somewhere--in the 
manual?--a way to show more than three decimal places in Csound, but 
now cannot find it. Am I mis-remembering? I'd like to show four 
places. In orchestra calculations, Csound looks to be rounding to 3 
places. Putting >3 decimal places in table values leads to an error, 
though putting >3 places in score p-fields seems to work fine.

Thanks--

--David

At 03:32 AM 12/3/2008, you wrote:
>To avoid this problem, I use the 'decimal' module (see 
>http://www.python.org/doc/2.5.2/lib/module-decimal.html). Take care 
>of the fact that decimal processes strings (not ints, floats...)
>I hope this helps.
>Cheers,
>
>[...snip...]

David Mooney:  dmooney@city-net.com
Maxine Heller:  mheller@city-net.com
Opaque Melodies:  www.city-net.com/~moko/


Date2008-12-03 16:19
From"Steven Yi"
Subject[Csnd] Re: Re: Re: Re: Scientific notation and constants
AttachmentsNone