float / rounding question

Sion Arrowsmith siona at chiark.greenend.org.uk
Mon Feb 25 09:32:04 EST 2008


Necmettin Begiter  <necmettin.begiter at gmail.com> wrote:
>25 February 2008 Monday 12:44:46 tarihinde helen.m.flynn at gmail.com =C5=9Fun=
>lar=C4=B1 yazm=C4=B1=C5=9Ft=C4=B1:
>> Of course the function above returns 53.600000000000001.
>>=20
>> How do I format it correctly?
>
>Use the round(number,digits) function:
>
>tf =3D round((9/5)*tc+32,1)

>>> 53.6
53.600000000000001
>>> round(53.6, 1)
53.600000000000001

-- 
\S -- siona at chiark.greenend.org.uk -- http://www.chaos.org.uk/~sion/
   "Frankly I have no feelings towards penguins one way or the other"
        -- Arthur C. Clarke
   her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump



More information about the Python-list mailing list