On 3/4/23 18:11, [email protected] 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 -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: [email protected]

Reply via email to