Skip to content

Add signbit specification for determining whether a sign bit is set#705

Merged
rgommers merged 3 commits intodata-apis:mainfrom
kgryte:feat/signbit
Dec 2, 2023
Merged

Add signbit specification for determining whether a sign bit is set#705
rgommers merged 3 commits intodata-apis:mainfrom
kgryte:feat/signbit

Conversation

@kgryte
Copy link
Copy Markdown
Contributor

@kgryte kgryte commented Nov 15, 2023

This PR

  • resolves Need for signbit in the array API spec #670 by adding a specification for signbit for determining whether a sign bit is set for each floating-point number in a provided input array.
  • follows Python conventions in which a boolean is returned. In C99, this is a macro which returns an integral value, where a positive result can be any non-zero integral value and a negative result must be zero.
  • limits the input data type to real-valued floating-point data types. The current text uses "should", indicating that array libraries may extend support to additional data types (e.g., signed integer data types) for, e.g., backward compatibility reasons. This PR does not use the more liberal real-valued data type, as the intent of this function is for distinguishing +0 and -0 and the determining the sign of NaN, values which are not possible outside of floating-point data types. For complex data types, users need to provide the real and imaginary components separately.
  • as this API is commonly implemented across array libraries without deviation, there are no open questions requiring resolution before specification inclusion.

Loading
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.

Need for signbit in the array API spec

3 participants