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.
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.
This PR
nextafter
to the specification.x2
to an array for portable behavior. While NumPy and others support scalars (and this is a common use case), PyTorch only supports tensors forx2
. 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.x2
have the same data type asx1
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 asx1
.x1
andx2
are equal and both zero, the result should bex2
.