On Mon, 24 May 2010 03:06:28 am Wayne Werner wrote:
> On Sat, May 22, 2010 at 9:58 AM, Steven D'Aprano
wrote:
> > On Sun, 23 May 2010 12:19:07 am Wayne Werner wrote:
> > > On Sat, May 22, 2010 at 7:32 AM, Steven D'Aprano
> >
> > wrote:
> > > > Why do people keep recommending Decimal? Decimals suff
On Sat, May 22, 2010 at 9:58 AM, Steven D'Aprano wrote:
> On Sun, 23 May 2010 12:19:07 am Wayne Werner wrote:
> > On Sat, May 22, 2010 at 7:32 AM, Steven D'Aprano
> wrote:
> > > Why do people keep recommending Decimal? Decimals suffer from the
> > > exact same issues as floats,
> >
> > This is exa
On 05/22/10 22:32, Steven D'Aprano wrote:
> On Sat, 22 May 2010 07:16:20 am wesley chun wrote:
>> correct, it is a floating point issue regardless of language.. it's
>> not just Python. you cannot accurately represent repeating fractions
>> with binary digits (bits). more info specific to Python he
On Sun, 23 May 2010 12:19:07 am Wayne Werner wrote:
> On Sat, May 22, 2010 at 7:32 AM, Steven D'Aprano
wrote:
> > Why do people keep recommending Decimal? Decimals suffer from the
> > exact same issues as floats,
>
> This is exactly incorrect! The Decimal operator offers /exact/
> decimal point op
On Sat, May 22, 2010 at 7:32 AM, Steven D'Aprano wrote:
> Why do people keep recommending Decimal? Decimals suffer from the exact
> same issues as floats,
>
This is exactly incorrect! The Decimal operator offers /exact/ decimal point
operations. They implement non-hardware operations to preserve
On Sat, 22 May 2010 07:16:20 am wesley chun wrote:
> correct, it is a floating point issue regardless of language.. it's
> not just Python. you cannot accurately represent repeating fractions
> with binary digits (bits). more info specific to Python here:
> http://docs.python.org/tutorial/floatingp
On Sat, 22 May 2010 07:51:31 am Alan Gauld wrote:
> "Neven Gorsic" wrote
>
> > I run into Python error in rounding and not know how to predict
> > when it will
> > occur in order to prevent wrong result.
>
> It depends how you define wrong. When I was at scvhool the rules f
> or rounding decimals
"Alan Gauld" wrote in message
news:ht6v97$63...@dough.gmane.org...
"Neven Gorsic" wrote
I run into Python error in rounding and not know how to predict when it
will
occur in order to prevent wrong result.
It depends how you define wrong. When I was at scvhool the rules f
or rounding dec
"Neven Goršić" wrote
It's pity that Python has such unreliable functions so
you never know in advanced when you will hit new one ...
The functions are not unreliable. That would imply they
give out unpredictable answers. In fact the answers are
completely predictable and consistent and correc
"Neven Gorsic" wrote
I run into Python error in rounding and not know how to predict when
it will
occur in order to prevent wrong result.
It depends how you define wrong. When I was at scvhool the rules f
or rounding decimals said that if it ended in 5 you rounded to the
nearest even digit.
correct, it is a floating point issue regardless of language.. it's
not just Python. you cannot accurately represent repeating fractions
with binary digits (bits). more info specific to Python here:
http://docs.python.org/tutorial/floatingpoint.html
also, keep in mind that '%f' is not a rounding o
On 5/21/2010 8:30 AM Neven Goršić said...
Thanks!
It's pity that Python has such unreliable functions so you never know in
advanced when you will hit new one ...
The problem is with floats, and all languages suffer similarly. Most of
us develop various techniques for avoiding these types of i
Thanks for the assistance and the article.
Neven
--
On Fri, May 21, 2010 at 5:35 PM, Lie Ryan wrote:
> On 05/22/10 01:30, Neven Goršić wrote:
> > Thanks!
> > It's pity that Python has such unreliable functions so you never know in
> > advanced when you will hit new one ...
On 05/22/10 01:30, Neven Goršić wrote:
> Thanks!
> It's pity that Python has such unreliable functions so you never know in
> advanced when you will hit new one ...
Well, it's not Python but the machine. Floating point number is not Real
numbers; there are certain limitations imposed by physical l
Thanks!
It's pity that Python has such unreliable functions so you never know in
advanced when you will hit new one ...
---
On Fri, May 21, 2010 at 2:14 PM, Lie Ryan wrote:
> On 05/21/10 20:17, Neven Goršić wrote:
> > Hi!
> >
> > I run into Python error in rounding and n
On 05/21/10 20:17, Neven Goršić wrote:
> Hi!
>
> I run into Python error in rounding and not know how to predict when it will
> occur in order to prevent wrong result.
That's because it's floating point number.
> What can I do to assure accurate result?
Use decimal module to do precise control
Hi!
I run into Python error in rounding and not know how to predict when it will
occur in order to prevent wrong result.
What can I do to assure accurate result?
>>> "%.2f" % 0.445
'0.45' correct
>>> "%.2f" % 0.455
'0.46' correct
17 matches
Mail list logo