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. If you want to print it to only three digits, then use something like:: >>> '%.3f' % 2.995423333545555 '2.995' -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis Whoever contends with the great sheds his own blood. -- Sa'di -- http://mail.python.org/mailman/listinfo/python-list