round function problem

mg mg.mailing-list at laposte.net
Tue Sep 6 09:27:48 CEST 2005


Hi everybody...

We try to white scripts with Pyrhon 2.4 for an acoustic simulation and 
we wrote these follow lines :

<begin script>
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
<end script>

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.

Is it a bug or a control behavour ? I don't understand ?!?!?!?!...

Thanks

Mathieu





More information about the Python-list mailing list