John Machin wrote:

> On Aug 27, 7:11 am, fred8865 <(E-Mail Removed)> wrote:

>

>> I understand that due to different arithmetic used in floating points

>> they are just approximations. Hence, 180/100=1 in my python interpreter.

>

> It's not "hence". What you are seeing is truncating integer division.

>

>> How can I tackle this problem of inaccurate floating point numbers?

>

>>>> 180 / 100

> 1

>>>> 180 / 100.

> 1.8

>>>> 180 / float(100)

> 1.8

>>>> from __future__ import division

>>>> 180 / 100

> 1.8

> --
Or start using 3.0, which fixed this

>>> 180/100
1.8