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

vectorize docstring example has incorrect identity #8227

Closed
1 of 2 tasks
bmcfee opened this issue Jul 6, 2022 · 1 comment · Fixed by #8228
Closed
1 of 2 tasks

vectorize docstring example has incorrect identity #8227

bmcfee opened this issue Jul 6, 2022 · 1 comment · Fixed by #8228
Labels
bug - documentation incorrect documentation is incorrect or missing something important

Comments

@bmcfee
Copy link

bmcfee commented Jul 6, 2022

Reporting a bug

This is a documentation bug more than a functionality bug, so reproducibility does not exactly apply.

The docstring example in vectorize provides a ufunc of sum that has identity=1. I believe this should be 0 (additive identity):

@vectorize(['float32(float32, float32)',
'float64(float64, float64)'], identity=1)
def sum(a, b):
return a + b

The later example for mul correctly sets identity=1.

  • I have tried using the latest released version of Numba (most recent is
    visible in the change log (https://github.com/numba/numba/blob/main/CHANGE_LOG).
  • I have included a self contained code sample to reproduce the problem.
    i.e. it's possible to run as 'python bug.py'.
    N/A
@esc
Copy link
Member

esc commented Jul 6, 2022

@bmcfee thank you for bringing this to our attention. This seems correct as the identity for addition is indeed 0.

@esc esc added the bug - documentation incorrect documentation is incorrect or missing something important label Jul 6, 2022
stuartarchibald added a commit to stuartarchibald/numba that referenced this issue Jul 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug - documentation incorrect documentation is incorrect or missing something important
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants