I refer to a post in the German forum by user 59590
A calculation on an Ubuntu 10.10 and Centos 5 installation Python 2.6.6 Centos Python 2.4 round(45.885.2) outputs 46,890000000000001 -> +1 Cent Fedora 14 mit Python 2.7 round(45.885,2) = 45.88
you can edit the numbers to be rounded with a simple function like that:
def runden(zahl,stellen): zahl = zahl*10**(stellen+1) zahl = round(zahl,-1) zahl = zahl*1/10**(stellen+1)
runden(45.885,2) => 45.89
The problem is the (wrong) rounding of each price and summing up those wrong rounded prices.
I refer to a post in the German forum by user 59590
A calculation on an Ubuntu 10.10 and Centos 5 installation
Python 2.6.6 Centos Python 2.4
round(45.885.2) outputs 46,890000000000001 -> +1 Cent
Fedora 14 mit Python 2.7
round(45.885,2) = 45.88
you can edit the numbers to be rounded with a simple function like that:
def runden( zahl,stellen) : *(stellen+ 1) 10**(stellen+ 1)
zahl = zahl*10*
zahl = round(zahl,-1)
zahl = zahl*1/
runden(45.885,2) => 45.89
The problem is the (wrong) rounding of each price and summing up those wrong rounded prices.