| >Hello,
>
>I'm reposting my question again: is there a way to perform calculations
>involving more than 3 decimal places or exponential notation in an
>orchestra file?
>
>Csound seems to ignore decimal places after 3. If I define a constant
>such as 0.0000000001 it seems to think it's 0.000 . I'm trying
>to code a sones-to-dB conversion formula in an insturment. It
>involves 10^-12.
>
>Thanks.
>Gregory Boduch
>gb141@columbia.edu
>
>
> One way to do it is calculate 1/100000000000 in your orchestra.
>The precision issue is at the translation from text to float, not
>internally (I think). Very large numbers should work fine.
>
>Mike Berry
>mikeb@mills.edu
>
>
Actually, that doesn't work - at least, not on my version of csound. It
seems that the largest number of digits I can enter is 10 - i.e.,
1000000000. is OK, but not one more 0. But you can do this:
ival = 1/(1000000 * 1000000) ;10^-12
or
ival = exp(12*log(10)) ;10^-12
and Csound does actually compute and store the correct result. In any case,
you can't prove it by using the Csound print function unless you do
something like:
print ival*1000000*1000000
which does, indeed, print out "1.000" when ival is 10^-12. Saying
print ival
just prints a "0.000"
----------------------------------
Russell F. Pinkston, D.M.A.
Associate Professor of Composition
Director, Electronic Music Studios
School of Music
The University of Texas at Austin
Austin, TX 78712
[512-471-0865]
|