[Tutor] Rounding
Danny Yoo
dyoo@hkn.eecs.berkeley.edu
Wed, 29 May 2002 16:29:00 -0700 (PDT)
On Wed, 29 May 2002, dman wrote:
> On Wed, May 29, 2002 at 08:03:39PM +0000, Terje Johan Abrahamsen wrote:
> | I am trying to use the round() function. But, it doesn't give me the
> | answers I want:
>
> Do a google search for "binary floating point" or "IEEE 754" or
> something along those lines. Also try writing out 1/3 in decimal
Python doesn't have an official "rational" type yet, so it opts to
represent fractions in a convenient-but-inexact "floating point"
representation.
The official Python tutorial mentions floating point in its appendix B:
http://www.python.org/doc/tut/node14.html
and offers some ways of working with it.
Hope this helps!