On 3/4/23 18:11, sideri...@gmail.com wrote:

The last element of "np.arange(0,20.01,0.01)" is 20.01 in my python result.

Is this numpy error ?
_______________________________________________


This is due to inaccurate float value representation. The documentation for arange states:

"When using a non-integer step, such as 0.1, it is often better to use |numpy.linspace| <https://numpy.org/devdocs/reference/generated/numpy.linspace.html#numpy.linspace>.

See the Warning sections below for more information."


Please read the warning section

https://numpy.org/devdocs/reference/generated/numpy.arange.html#numpy-arange.


Matti


_______________________________________________
NumPy-Discussion mailing list -- numpy-discussion@python.org
To unsubscribe send an email to numpy-discussion-le...@python.org
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: arch...@mail-archive.com

Reply via email to