Is round() broken?
Fredrik Lundh
fredrik at pythonware.com
Wed Oct 31 17:52:12 EST 2001
Joseph Wilhelm wrote:
> I'm having some troubles with round() now... either I'm doing it completely
> wrong or round() is.
round is doing what it's supposed to do. and there's nothing
wrong with the way you use it either. read on.
> >>> round( 43583.010000000002, 2 )
> 43583.010000000002
on the other hand,
>>> print round(43583.010000000000002, 2)
43583.01
looks like the same number might look different, depending on
how you print it. confusing? read on.
> If I look at the field through pgAdmin, I just see it as "43583.01",
> instead of that whole big long decimal. Is it supposed to come out
> like this?
it depends on what you do to print it. for the full story, read this:
http://python.sourceforge.net/devel-docs/tut/node14.html
</F>
More information about the Python-list
mailing list