Re: floating point arithmetic

2008-08-26 Thread Gabriel Genellina
En Tue, 26 Aug 2008 18:11:30 -0300, fred8865 <[EMAIL PROTECTED]> escribi�: I understand that due to different arithmetic used in floating points they are just approximations. Hence, 180/100=1 in my python interpreter. How can I tackle this problem of inaccurate floating point numbers? thank you

Re: floating point arithmetic

2008-08-26 Thread Terry Reedy
John Machin wrote: On Aug 27, 7:11 am, fred8865 <[EMAIL PROTECTED]> wrote: I understand that due to different arithmetic used in floating points they are just approximations. Hence, 180/100=1 in my python interpreter. It's not "hence". What you are seeing is truncating integer division. H

Re: floating point arithmetic

2008-08-26 Thread fred8865
thanks guys fred8865 wrote: > Hi all, > > I understand that due to different arithmetic used in floating points > they are just approximations. Hence, 180/100=1 in my python interpreter. > How can I tackle this problem of inaccurate floating point numbers? > thank you > > regards > xtd -- http

Re: floating point arithmetic

2008-08-26 Thread John Machin
On Aug 27, 7:11 am, fred8865 <[EMAIL PROTECTED]> wrote: > I understand that due to different arithmetic used in floating points > they are just approximations. Hence, 180/100=1 in my python interpreter. It's not "hence". What you are seeing is truncating integer division. > How can I tackle this

Re: floating point arithmetic

2008-08-26 Thread Mensanator
On Aug 26, 4:11 pm, fred8865 <[EMAIL PROTECTED]> wrote: > Hi all, > > I understand that due to different arithmetic used in floating points > they are just approximations. Hence, 180/100=1 in my python interpreter. > How can I tackle this problem of inaccurate floating point numbers? Try actually

Re: floating point arithmetic

2008-08-26 Thread Rob Clewley
> I understand that due to different arithmetic used in floating points > they are just approximations. Hence, 180/100=1 in my python interpreter. No, that's not the reason you get 1, it's because the current version of python does integer division by default. Try doing 180.0/100 or including fro