Re: round function problem

2005-09-06 Thread Bengt Richter
On Tue, 06 Sep 2005 09:27:48 +0200, mg <[EMAIL PROTECTED]> wrote: >Hi everybody... > >We try to white scripts with Pyrhon 2.4 for an acoustic simulation and >we wrote these follow lines : > > >c = 340 340 is an integer, which is different from 340. >i =j=k= 1 >sum_ = 23 also an integer >table = [

Re: round function problem

2005-09-06 Thread Magnus Lycka
mg wrote: > The problem is simple. The function 'round' allow to obtain the value > with the specified number of digits after the ",". Then, when the > variable 'freq' is printed, there is no problem; but when freq is set in > the table and the table printed, all the digits are come back. > > I

Re: round function problem

2005-09-06 Thread Gregory Bond
mg wrote: > Is it a bug or a control behavour ? I don't understand ?!?!?!?!... It's a case of applying different float-to-text rounding in different situations, on a variable that (even after round()) is not representable in binary floatingpoint. "print var" does one sort of string conversion

Re: round function problem

2005-09-06 Thread Fredrik Lundh
"mg" wrote: > We try to white scripts with Pyrhon 2.4 for an acoustic simulation and > we wrote these follow lines : > > > c = 340 > i =j=k= 1 > sum_ = 23 > table = [] > freq = round((c/2*(sum_)**0.5),2) > print freq > table.append([freq,(i,j,k)]) > print i,j,k,' freq',freq > for item in table: p

round function problem

2005-09-06 Thread mg
Hi everybody... We try to white scripts with Pyrhon 2.4 for an acoustic simulation and we wrote these follow lines : c = 340 i =j=k= 1 sum_ = 23 table = [] freq = round((c/2*(sum_)**0.5),2) print freq table.append([freq,(i,j,k)]) print i,j,k,' freq',freq for item in table: print item The prob