Re: [Numpy-discussion] Question about numpy.arange()

2010-05-03 Thread Alan G Isaac
On 5/2/2010 1:51 PM, Gökhan Sever wrote: > The following is another surprise output: > > I[5]: c = np.arange(0.4, 0.5, 0.1, dtype='float32') > [6]: c > O[6]: array([ 0.4001], dtype=float32) >>> a = np.array([0.4,0.5,0.1], dtype='float32') >>> a[0] 0.4001 >>> (a[1]-a[0])/a[2] 0.9994 >

Re: [Numpy-discussion] Question about numpy.arange()

2010-05-03 Thread Gökhan Sever
On Sat, May 1, 2010 at 3:36 PM, Gökhan Sever wrote: > Hello, > > Is "b" an expected value? I am suspecting another floating point arithmetic > issue. > > I[1]: a = np.arange(1.6, 1.8, 0.1, dtype='float32') > > I[2]: a > O[2]: array([ 1.6002, 1.7005], dtype=float32) > > I[3]: b = np.arang

Re: [Numpy-discussion] Question about numpy.arange()

2010-05-02 Thread Robert Kern
On Sat, May 1, 2010 at 15:36, Gökhan Sever wrote: > Hello, > > Is "b" an expected value? I am suspecting another floating point arithmetic > issue. > > I[1]: a = np.arange(1.6, 1.8, 0.1, dtype='float32') > > I[2]: a > O[2]: array([ 1.6002,  1.7005], dtype=float32) > > I[3]: b = np.arange(1

Re: [Numpy-discussion] Question about numpy.arange()

2010-05-02 Thread Warren Weckesser
Gökhan Sever wrote: > Hello, > > Is "b" an expected value? I am suspecting another floating point > arithmetic issue. Exactly. You'll see the same type of problem with float64, too: In [17]: z = np.arange(1.7, 1.8, 0.1) In [18]: z Out[18]: array([ 1.7, 1.8]) In [19]: z[1] == 1.8 Out[19]: Tr

Re: [Numpy-discussion] Question about numpy.arange()

2010-05-02 Thread Keith Goodman
On Sat, May 1, 2010 at 1:36 PM, Gökhan Sever wrote: > Hello, > > Is "b" an expected value? I am suspecting another floating point arithmetic > issue. > > I[1]: a = np.arange(1.6, 1.8, 0.1, dtype='float32') > > I[2]: a > O[2]: array([ 1.6002,  1.7005], dtype=float32) > > I[3]: b = np.arange

Re: [Numpy-discussion] Question about numpy.arange()

2010-05-02 Thread Anne Archibald
On 1 May 2010 16:36, Gökhan Sever wrote: > Hello, > > Is "b" an expected value? I am suspecting another floating point arithmetic > issue. > > I[1]: a = np.arange(1.6, 1.8, 0.1, dtype='float32') > > I[2]: a > O[2]: array([ 1.6002,  1.7005], dtype=float32) > > I[3]: b = np.arange(1.7, 1.8,

[Numpy-discussion] Question about numpy.arange()

2010-05-01 Thread Gökhan Sever
Hello, Is "b" an expected value? I am suspecting another floating point arithmetic issue. I[1]: a = np.arange(1.6, 1.8, 0.1, dtype='float32') I[2]: a O[2]: array([ 1.6002, 1.7005], dtype=float32) I[3]: b = np.arange(1.7, 1.8, 0.1, dtype='float32') I[4]: b O[4]: array([ 1.7005, 1.