2

I just found a weird thing in Python2/3. It seems it's a bug? I only put an example using Python2

I think np.arange(-0.1, 0.2, 0.1) should give [-0.1, 0., 0.1]? Any explanation? Thanks

astroboylrx
  • 881
  • 1
  • 8
  • 18
  • possible duplicate of [Python decimal range() step value](http://stackoverflow.com/questions/477486/python-decimal-range-step-value) – Andrew Jaffe Feb 19 '15 at 09:47

1 Answers1

1

http://docs.scipy.org/doc/numpy/reference/generated/numpy.arange.html

"When using a non-integer step, such as 0.1, the results will often not be consistent. It is better to use linspace for these cases."

etna
  • 1,083
  • 7
  • 13