Skip to content

Indicate that abs() of the minimum integer value for signed dtypes is undefined #250

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

Merged
merged 6 commits into from
Sep 20, 2021

Conversation

asmeurer
Copy link
Member

@asmeurer asmeurer commented Sep 1, 2021

No description provided.

@asmeurer
Copy link
Member Author

asmeurer commented Sep 3, 2021

Should we add the same note for negative?

I noticed that NumPy uses -(min value) = min value (e.g., np.negative(-128, dtype=np.int8) == -128) and abs(min value) = min value. This has the properties that -x + x always equals 0, and abs(x) = -x for x < 0.

asmeurer added a commit to data-apis/array-api-tests that referenced this pull request Sep 3, 2021
I am assuming for now that negative() is not defined for the smallest
representable negative integer for signed integer dtypes (see
data-apis/array-api#250).
@rgommers
Copy link
Member

rgommers commented Sep 5, 2021

Should we add the same note for negative?

Seems reasonable to me.

@rgommers rgommers added the Maintenance Bug fix, typo fix, or general maintenance. label Sep 5, 2021
"smallest" is ambiguous, as could mean `0` or the minimum value (e.g., `-128` for `int8`).
Copy link
Contributor

@kgryte kgryte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@kgryte
Copy link
Contributor

kgryte commented Sep 20, 2021

I'll make a separate PR for negative.

@kgryte kgryte merged commit 5565ac4 into data-apis:main Sep 20, 2021
kgryte added a commit that referenced this pull request Sep 20, 2021
cr313 added a commit to cr313/test-array-api that referenced this pull request Apr 19, 2024
I am assuming for now that negative() is not defined for the smallest
representable negative integer for signed integer dtypes (see
data-apis/array-api#250).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Maintenance Bug fix, typo fix, or general maintenance.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants