round(22.47,2) gives 22.469999999999999?

Daniel Klein danielk at aracnet.com
Wed Aug 6 14:51:17 CEST 2003


On Wed, 06 Aug 2003 13:12:21 +0200, Eric van Riet Paap
<eric at vanrietpaap.com> wrote:

>Hi,
>
>On python2.1.3, python2.2.1 and python2.2.3 round(22.47,2) gives 
>22.469999999999999 . Does anyone know if this is a bug or some weird, yet 
>unexpected, behaviour?
>

Wouldn't

int(22.47 + .5)

get you to where you want to go?

Dan




More information about the Python-list mailing list