Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

a bug about np.arrange #79368

Closed
xyl123 mannequin opened this issue Nov 8, 2018 · 3 comments
Closed

a bug about np.arrange #79368

xyl123 mannequin opened this issue Nov 8, 2018 · 3 comments
Labels
stdlib Python modules in the Lib dir

Comments

@xyl123
Copy link
Mannequin

xyl123 mannequin commented Nov 8, 2018

BPO 35187
Nosy @mdickinson

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2018-11-08.08:04:52.768>
created_at = <Date 2018-11-08.07:57:46.775>
labels = ['library']
title = 'a bug about np.arrange'
updated_at = <Date 2018-11-08.08:06:47.548>
user = 'https://bugs.python.org/xyl123'

bugs.python.org fields:

activity = <Date 2018-11-08.08:06:47.548>
actor = 'mark.dickinson'
assignee = 'none'
closed = True
closed_date = <Date 2018-11-08.08:04:52.768>
closer = 'mark.dickinson'
components = ['Library (Lib)']
creation = <Date 2018-11-08.07:57:46.775>
creator = 'xyl123'
dependencies = []
files = []
hgrepos = []
issue_num = 35187
keywords = []
message_count = 3.0
messages = ['329460', '329461', '329462']
nosy_count = 2.0
nosy_names = ['mark.dickinson', 'xyl123']
pr_nums = []
priority = 'normal'
resolution = 'third party'
stage = 'resolved'
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue35187'
versions = ['Python 3.5']

@xyl123
Copy link
Mannequin Author

xyl123 mannequin commented Nov 8, 2018

when I use np.arange as follows:
np.arange(1,2.2,0.2)
I got the array as [1. , 1.2, 1.4, 1.6, 1.8, 2. , 2.2],we know, the maxvalue 2.2 of the array should not be included in the array. Is this a bug?

@xyl123 xyl123 mannequin added the stdlib Python modules in the Lib dir label Nov 8, 2018
@mdickinson
Copy link
Member

np.arange is part of NumPy, not core Python; I'd suggest asking this question on the NumPy mailing lists, e.g. https://mail.python.org/pipermail/numpy-discussion/

But no, it's not a bug; it's a well-known gotcha.

@mdickinson
Copy link
Member

It's also worth taking a look at the documentation: https://docs.scipy.org/doc/numpy-1.15.0/reference/generated/numpy.arange.html

See particularly the "Result" section, where it says:

Because of floating point overflow, this rule may result in the last > element of out being greater than stop.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir
Projects
None yet
Development

No branches or pull requests

1 participant