Title: RE: results of division
[Paul McGuire]
#- Errr? How come round() is able to understand 1.775
#- correctly, whereas
#- string interp is not? I'm guessing that round() adds some
#- small epsilon to
#- the value to be rounded, or perhaps even does the brute
#- force round
Aahz wrote:
In article <[EMAIL PROTECTED]>,
Peter Hansen <[EMAIL PROTECTED]> wrote:
So, from the sounds of it, you really care about this
^don't
rounding operation in the displayed values, in which
case the "'%.2f' % value" approach ought to be fine.
Right?
I think w
In article <[EMAIL PROTECTED]>,
Peter Hansen <[EMAIL PROTECTED]> wrote:
>Brad Tilley wrote:
>> Peter Hansen wrote:
>>> The answer is "what are you trying to do?". The others have
>>> given options and good advice, but the "right" approach
>>> depends on what exactly you are doing. Is this just f
Brad Tilley wrote:
> Hello,
>
> What is the proper way to limit the results of division to only a few
> spaces after the decimal? I don't need rocket-science like precision.
> Here's an example:
If your only complaint is that it's ugly to display 17 digits, then
In article <[EMAIL PROTECTED]>,
Brad Tilley <[EMAIL PROTECTED]> wrote:
> > Brad Tilley wrote:
> >
> >> What is the proper way to limit the results of division to only a few
> >> spaces after the decimal? I don't need rocket-science like precision.
"Paul McGuire" <[EMAIL PROTECTED]> writes:
> Errr? How come round() is able to understand 1.775 correctly, whereas
> string interp is not? I'm guessing that round() adds some small epsilon to
> the value to be rounded, or perhaps even does the brute force rounding I
> learned in FORTRAN back in
Brad Tilley wrote:
Peter Hansen wrote:
The answer is "what are you trying to do?". The others have
given options and good advice, but the "right" approach
depends on what exactly you are doing. Is this just for
display purposes, or is there more significant (though
perhaps not "precision-critical
[Paul McGuire]
...
> >>> print "%.2f" % 1.775
> 1.77
>
> Hmmm, if we rounded, I would have expected 1.775 to round up
> to 1.78.
Platform-dependent. 1.775 isn't exactly representable regardless, but
whether exactly-half-way numbers that are exactly representable round
up or truncate varies across
Peter Hansen wrote:
Brad Tilley wrote:
What is the proper way to limit the results of division to only a few
spaces after the decimal? I don't need rocket-science like precision.
Here's an example:
1.775 is as exact as I need to be and normally, 1.70 will do.
The answer is "what
Simon Brunning wrote:
On Thu, 09 Dec 2004 09:38:55 -0500, Brad Tilley <[EMAIL PROTECTED]> wrote:
What is the proper way to limit the results of division to only a few
spaces after the decimal? I don't need rocket-science like precision.
Here's an example:
1.775 is as exact as
"Paul Rubin" <http://[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Brad Tilley <[EMAIL PROTECTED]> writes:
> > What is the proper way to limit the results of division to only a few
> > spaces after the decimal? I don't need rocket-sci
Brad Tilley wrote:
What is the proper way to limit the results of division to only a few
spaces after the decimal? I don't need rocket-science like precision.
Here's an example:
1.775 is as exact as I need to be and normally, 1.70 will do.
The answer is "what are you trying to do
In article <[EMAIL PROTECTED]>,
Brad Tilley <[EMAIL PROTECTED]> wrote:
>
>What is the proper way to limit the results of division to only a few
>spaces after the decimal? I don't need rocket-science like precision.
>Here's an example:
>
>1.775 is as exact
Brad Tilley <[EMAIL PROTECTED]> writes:
> What is the proper way to limit the results of division to only a few
> spaces after the decimal? I don't need rocket-science like
> precision. Here's an example:
>
> 1.775 is as exact as I need to be and normally, 1.70 w
On Thu, 09 Dec 2004 09:38:55 -0500, Brad Tilley <[EMAIL PROTECTED]> wrote:
> What is the proper way to limit the results of division to only a few
> spaces after the decimal? I don't need rocket-science like precision.
> Here's an example:
>
> 1.775 is as exact as
Hello,
What is the proper way to limit the results of division to only a few
spaces after the decimal? I don't need rocket-science like precision.
Here's an example:
1.775 is as exact as I need to be and normally, 1.70 will do.
Thank you,
Brad
--
http://mail.python.org/mailman/listi
16 matches
Mail list logo