Hi,
Is there an easy way - a module or method for which you can round off number
such as
2.1345 to 2.135
Any help or advice appreciated?
--
Best regards
Per Jr. Greisen
___
Tutor maillist - Tutor@python.org
At 03:08 AM 3/18/2007, Per Jr. Greisen wrote:
Hi,
Is there an easy way - a module or method for which you can round
off number such as
2.1345 to 2.135
Well, there are
print %.3f % 2.1345
2.135
or
print round(2.1345, 3)
2.135
Dick Moores
___
Dick Moores wrote:
At 03:08 AM 3/18/2007, Per Jr. Greisen wrote:
Hi,
Is there an easy way - a module or method for which you can round
off number such as
2.1345 to 2.135
Well, there are
print %.3f % 2.1345
2.135
or
print round(2.1345, 3)
2.135
The difference between
At 04:59 AM 3/18/2007, Dick Moores wrote:
At 03:08 AM 3/18/2007, Per Jr. Greisen wrote:
Hi,
Is there an easy way - a module or method for which you can round
off number such as
2.1345 to 2.135
Well, there are
print %.3f % 2.1345
2.135
or
print round(2.1345, 3)
2.135
print
Dick Moores wrote:
print round(2.1345, 3)
2.135
But now I have a question.
print %.3f % 22.1345
22.134
Why the 22.134's?
Because neither 2.1345 nor 22.1345 can be represented exactly in
floating point, and the errors are in the opposite direction:
In [4]: repr(22.1345)
Out[4]:
Hi,
I use the method from math in order to round off the number:
import math
a = 1.3
b = round(a,3)
which equals gives
b=1.4
is it possible to have the rounding such that
b = 1.400
so it keeps in my case the correct digits?
Any help appreciate. Thanks in advance
--
Best regards
Per
Hi bady,
www.ppibiz.com
My name is Isaack Harms with The ProfitMasters Team. It was nice to talk
with you this afternoon. You requested information after watching my movie
online at www.profitsfromtheweb.net I am here to be your guide through this
process and I look forward to
Hi,
Thanks for the help guys.
I have tried gui programming using Tkinter and use the Button class which
accepts the command argument which is a function object.
The question is how to send arguments if the function accepts arguments.
-
Get your own web
Per Jr. Greisen wrote:
Hi,
I use the method from math in order to round off the number:
import math
a = 1.3
b = round(a,3)
which equals gives
b=1.4
is it possible to have the rounding such that
b = 1.400
Trailing zeroes aren't significant values so the computer won't store it.