Re: Array and floating point

2007-08-17 Thread Robert Kern
Jonathan Shan wrote: > Hello, > > I'm experiencing a problem where the float being appended to the array > is not the same as the result of the appending. > from array import * x = array('f') x.append(float("0.1")) x[0] > 0.1000149011612 float("0.1") > 0.1

Re: Array and floating point

2007-08-17 Thread Peter Otten
Jonathan Shan wrote: > Hello, > > I'm experiencing a problem where the float being appended to the array > is not the same as the result of the appending. > from array import * x = array('f') x.append(float("0.1")) x[0] > 0.1000149011612 float("0.1") > 0.1000

Re: Array and floating point

2007-08-17 Thread Zentrader
On Aug 17, 2:06 pm, Jonathan Shan <[EMAIL PROTECTED]> wrote: > Hello, > > I'm experiencing a problem where the float being appended to the array > is not the same as the result of the appending. > > >>> from array import * > >>> x = array('f') > >>> x.append(float("0.1")) > >>> x[0] > 0.1000149

Array and floating point

2007-08-17 Thread Jonathan Shan
Hello, I'm experiencing a problem where the float being appended to the array is not the same as the result of the appending. >>> from array import * >>> x = array('f') >>> x.append(float("0.1")) >>> x[0] 0.1000149011612 >>> float("0.1") 0.10001 I'm expecting x[0] = 0.100