Is round() broken?
fredrik at pythonware.com
Wed Oct 31 23:52:12 CET 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 )
on the other hand,
>>> print round(43583.010000000000002, 2)
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:
More information about the Python-list