python rounding problem.

Gary Wessle phddas at yahoo.com
Sun May 7 11:15:46 EDT 2006


Erik Max Francis <max at alcyone.com> 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?




More information about the Python-list mailing list