Re: [Hampshire] Python multiplicaton

Top Page

Reply to this message
Author: Stuart Matheson
Date:  
To: Hampshire LUG Discussion List
Subject: Re: [Hampshire] Python multiplicaton
Hey Owain,

It is to do with how numbers are represented on computers. Have a look at
http://en.wikipedia.org/wiki/Floating_point for a more detailed explanation.
Perhaps if you limit the output to a single decimal place then you'll get
22.8.

Cheers,

Stuart

2010/1/14 Owain Clarke <simbobo@???>

> Could anyone explain to me why 3*7.6 gives me 22.799999999999997? I have
> Python 2.5.2
>
> Cheers
>
> Owain Clarke
>
>
> --
> Please post to: Hampshire@???
> Web Interface: https://mailman.lug.org.uk/mailman/listinfo/hampshire
> LUG URL: http://www.hantslug.org.uk
> --------------------------------------------------------------
>