Skip to content

feat: add nextafter to specification #792

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 1 commit into from
May 2, 2024
Merged

Conversation

kgryte
Copy link
Contributor

@kgryte kgryte commented Apr 18, 2024

This PR

  • resolves RFC: add nextafter #664 by adding nextafter to the specification.
  • restricts x2 to an array for portable behavior. While NumPy and others support scalars (and this is a common use case), PyTorch only supports tensors for x2. In general, we are consistent throughout the specification in requiring that positional array arguments be strictly arrays. Were we to make an exception here, I'd imagine that the exception would apply equally to other arithmetic operations (e.g., add, multiply, etc) for which we have standardized functional APIs.
  • requires ("should") that x2 have the same data type as x1 for portable behavior. Libraries are free to support other data types and subsequently type promotion (e.g., NumPy), but this should not be guaranteed across conforming array libraries, as the general expectation is that one typically wants the next representable value in the same precision as x1.
  • follows C99 (checked with NumPy) in ensuring consistent behavior around zero. Namely, when x1 and x2 are equal and both zero, the result should be x2.

@kgryte kgryte added API extension Adds new functions or objects to the API. Needs Review Pull request which needs review. labels Apr 18, 2024
@kgryte kgryte added this to the v2024 milestone Apr 18, 2024
Copy link
Member

@rgommers rgommers left a comment

Choose a reason for hiding this comment

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

Thanks @kgryte. The choices in the PR description sounds right, and the text LGTM.

@kgryte kgryte removed the Needs Review Pull request which needs review. label May 2, 2024
@kgryte
Copy link
Contributor Author

kgryte commented May 2, 2024

As this PR has received approval and no objections have been raised, will go ahead and merge. Should changes need to be made, we have time to correct before we cut the 2024 release.

@kgryte kgryte merged commit cee4167 into data-apis:main May 2, 2024
3 checks passed
@kgryte kgryte deleted the feat/nextafter branch May 2, 2024 04:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API extension Adds new functions or objects to the API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RFC: add nextafter
2 participants