Simple calculation error

2008-01-04 Thread Francois Liot
Dear all,

 

I observed a strange calculation answer, on both python 2.3.4 and 2.4.4

 

>>> print 753343.44 - 753361.89

-18.450001

>>> print ( (753361.89*100) - (753343.44*100) ) / 100

18.45

 

Can somebody help me to play correctly with decimal values?

 

Thanks in advance,

 

Francois Liot

-- 
http://mail.python.org/mailman/listinfo/python-list

RE: Simple calculation error

2008-01-04 Thread Francois Liot
No the change of sign is due to a fake copy and past,
My question was related to decimal calculation.

Thanks,

Francois Liot

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Paul McGuire
Sent: Friday, January 04, 2008 1:46 PM
To: python-list@python.org
Subject: Re: Simple calculation error

On Jan 4, 12:30 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> Francois Liot wrote:
>
> > I observed a strange calculation answer, on both python 2.3.4 and 2.4.4
>
> >> >> print 753343.44 - 753361.89
>
> > -18.450001
>
> >> >> print ( (753361.89*100) - (753343.44*100) ) / 100
>
> > 18.45
>
> > Can somebody help me to play correctly with decimal values?
>

If the OP is questioning the change in sign, the operands are reversed
in the second statement.

-- Paul
-- 
http://mail.python.org/mailman/listinfo/python-list
-- 
http://mail.python.org/mailman/listinfo/python-list