Gary Wessle wrote: > Erik Max Francis <[EMAIL PROTECTED]> writes: > > >>chun ping wang wrote: >> >> >>>Hey i have a stupid question. >>>How do i get python to print the result in only three decimal >>>place... >>>Example>>> round (2.995423333545555, 3) >>>2.9950000000000001 >>>but i want to get rid of all trailing 0's..how would i do that? >> >>Floating point arithmetic is inherently imprecise. This is not a >>Python problem. > > > does python support true rations, which means that 1/3 is a true > one-third and not 0.333333333 rounded off at some arbitrary precision? >
Python doesn't directly support rationals but there are at least two third party modules that add this capability to Python. http://calcrpnpy.sourceforge.net/clnumManual.html http://gmpy.sourceforge.net/ -- http://mail.python.org/mailman/listinfo/python-list