[Csnd] Scientific notation in GEN23
Date | 2008-07-21 14:04 |
From | Mark Van Peteghem |
Subject | [Csnd] Scientific notation in GEN23 |
I just tried to read in a file with numeric values using GEN23. Sometimes it worked fine, but mostly not. I found out that this is because numbers in scientific notation are ignored by this GEN routine. This was obvious from the error message 'ftable 101: 3 elements in values.txt' when there were 3 numbers in non-scientific notation, and it still matches when I changed more values to non-scientific notation. Here is a sample from the file, the scientific notation seems correct to me: 5.10908902806e-12 1.25015286639e-09 1.12535174719e-07 3.72665317208e-06 4.53999297625e-05 0.000203468369011 0.000335462627903 0.000203468369011 A search with Google indicates that this was fixed in 2003, it seems that this bug somehow came back. -- Mark _________________________________________ When you get lemons, you make lemonade. When you get hardware, you make software. |
Date | 2008-07-21 14:50 |
From | peiman khosravi |
Subject | [Csnd] Re: Scientific notation in GEN23 |
yes yes I've been having this problem too. Since I use mostly PWGL to generate data for the txt files I can't avoid using scientific notation unless I round things up which is not good. Best Peiman On 21 Jul 2008, at 14:04, Mark Van Peteghem wrote: > I just tried to read in a file with numeric values using GEN23. > Sometimes it worked fine, but mostly not. I found out that this is > because numbers in scientific notation are ignored by this GEN > routine. This was obvious from the error message 'ftable 101: 3 > elements in values.txt' when there were 3 numbers in non-scientific > notation, and it still matches when I changed more values to non- > scientific notation. > > Here is a sample from the file, the scientific notation seems > correct to me: > > 5.10908902806e-12 > 1.25015286639e-09 > 1.12535174719e-07 > 3.72665317208e-06 > 4.53999297625e-05 > 0.000203468369011 > 0.000335462627903 > 0.000203468369011 > > A search with Google indicates that this was fixed in 2003, it > seems that this bug somehow came back. > > -- > Mark > _________________________________________ > When you get lemons, you make lemonade. > When you get hardware, you make software. > > > > Send bugs reports to this list. > To unsubscribe, send email sympa@lists.bath.ac.uk with body > "unsubscribe csound" |
Date | 2008-07-21 15:38 |
From | Victor Lazzarini |
Subject | [Csnd] Re: Re: Scientific notation in GEN23 |
a workaround would be to use a simple python script import string f1 = open('original') f2 = open('translated', 'w') data = f1.read() for i in string.split(data): f2.write("%f" % float(i)) Victor At 14:50 21/07/2008, you wrote: >yes yes I've been having this problem too. Since I use mostly PWGL to >generate data for the txt files I can't avoid using scientific >notation unless I round things up which is not good. > >Best >Peiman > >On 21 Jul 2008, at 14:04, Mark Van Peteghem wrote: > >>I just tried to read in a file with numeric values using GEN23. >>Sometimes it worked fine, but mostly not. I found out that this is >>because numbers in scientific notation are ignored by this GEN >>routine. This was obvious from the error message 'ftable 101: 3 >>elements in values.txt' when there were 3 numbers in non-scientific >>notation, and it still matches when I changed more values to non- >>scientific notation. >> >>Here is a sample from the file, the scientific notation seems >>correct to me: >> >>5.10908902806e-12 >>1.25015286639e-09 >>1.12535174719e-07 >>3.72665317208e-06 >>4.53999297625e-05 >>0.000203468369011 >>0.000335462627903 >>0.000203468369011 >> >>A search with Google indicates that this was fixed in 2003, it >>seems that this bug somehow came back. >> >>-- >> Mark >> _________________________________________ >> When you get lemons, you make lemonade. >> When you get hardware, you make software. >> >> >> >>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" Victor Lazzarini Music Technology Laboratory Music Department National University of Ireland, Maynooth |
Date | 2008-07-21 16:09 |
From | peiman khosravi |
Subject | [Csnd] Re: Re: Re: Scientific notation in GEN23 |
wow! Thanks for that. Peiman On 21 Jul 2008, at 15:38, Victor Lazzarini wrote: > a workaround would be to use a simple python script > > import string > f1 = open('original') > f2 = open('translated', 'w') > data = f1.read() > for i in string.split(data): f2.write("%f" % float(i)) > > Victor > > At 14:50 21/07/2008, you wrote: >> yes yes I've been having this problem too. Since I use mostly PWGL to >> generate data for the txt files I can't avoid using scientific >> notation unless I round things up which is not good. >> >> Best >> Peiman >> >> On 21 Jul 2008, at 14:04, Mark Van Peteghem wrote: >> >>> I just tried to read in a file with numeric values using GEN23. >>> Sometimes it worked fine, but mostly not. I found out that this is >>> because numbers in scientific notation are ignored by this GEN >>> routine. This was obvious from the error message 'ftable 101: 3 >>> elements in values.txt' when there were 3 numbers in non-scientific >>> notation, and it still matches when I changed more values to non- >>> scientific notation. >>> >>> Here is a sample from the file, the scientific notation seems >>> correct to me: >>> >>> 5.10908902806e-12 >>> 1.25015286639e-09 >>> 1.12535174719e-07 >>> 3.72665317208e-06 >>> 4.53999297625e-05 >>> 0.000203468369011 >>> 0.000335462627903 >>> 0.000203468369011 >>> >>> A search with Google indicates that this was fixed in 2003, it >>> seems that this bug somehow came back. >>> >>> -- >>> Mark >>> _________________________________________ >>> When you get lemons, you make lemonade. >>> When you get hardware, you make software. >>> >>> >>> >>> 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" > > Victor Lazzarini > Music Technology Laboratory > Music Department > National University of Ireland, Maynooth > > > Send bugs reports to this list. > To unsubscribe, send email sympa@lists.bath.ac.uk with body > "unsubscribe csound" |
Date | 2008-07-21 20:49 |
From | Mark Van Peteghem |
Subject | [Csnd] Re: Re: Re: Scientific notation in GEN23 |
My file is actually created by a Python script, so it should be easy to adjust it. Thanks, I'm still new to Python. Victor Lazzarini schreef: > a workaround would be to use a simple python script > > import string > f1 = open('original') > f2 = open('translated', 'w') > data = f1.read() > for i in string.split(data): f2.write("%f" % float(i)) > > Victor > > At 14:50 21/07/2008, you wrote: >> yes yes I've been having this problem too. Since I use mostly PWGL to >> generate data for the txt files I can't avoid using scientific >> notation unless I round things up which is not good. >> >> Best >> Peiman >> >> On 21 Jul 2008, at 14:04, Mark Van Peteghem wrote: >> >>> I just tried to read in a file with numeric values using GEN23. >>> Sometimes it worked fine, but mostly not. I found out that this is >>> because numbers in scientific notation are ignored by this GEN >>> routine. This was obvious from the error message 'ftable 101: 3 >>> elements in values.txt' when there were 3 numbers in non-scientific >>> notation, and it still matches when I changed more values to non- >>> scientific notation. >>> >>> Here is a sample from the file, the scientific notation seems >>> correct to me: >>> >>> 5.10908902806e-12 >>> 1.25015286639e-09 >>> 1.12535174719e-07 >>> 3.72665317208e-06 >>> 4.53999297625e-05 >>> 0.000203468369011 >>> 0.000335462627903 >>> 0.000203468369011 >>> >>> A search with Google indicates that this was fixed in 2003, it >>> seems that this bug somehow came back. >>> >>> -- >>> Mark >>> _________________________________________ >>> When you get lemons, you make lemonade. >>> When you get hardware, you make software. >>> >>> >>> >>> 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" > > Victor Lazzarini > Music Technology Laboratory > Music Department > National University of Ireland, Maynooth > > > Send bugs reports to this list. > To unsubscribe, send email sympa@lists.bath.ac.uk with body > "unsubscribe csound" > > -- Mark _________________________________________ When you get lemons, you make lemonade. When you get hardware, you make software. |
Date | 2008-07-22 22:09 |
From | Tobiah |
Subject | [Csnd] Re: Re: Re: Re: Scientific notation in GEN23 |
Mark Van Peteghem wrote: > My file is actually created by a Python script, so it should be easy to > adjust it. Thanks, I'm still new to Python. I believe that you might benefit from looking at the 'decimal' module. http://docs.python.org/lib/module-decimal.html The idea is that you can represent floating point numbers exactly, to any precision. |