8000 feat: add support for specifying a data type "kind" in `astype` by lucascolley · Pull Request #848 · data-apis/array-api · GitHub
[go: up one dir, main page]

Skip to content

feat: add support for specifying a data type "kind" in astype #848

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

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
add note on unspecified promotion
  • Loading branch information
lucascolley committed Oct 28, 2024
commit d4450b3a0a10c8dbaa20877adb53f72fef8bed78
1 change: 1 addition & 0 deletions src/array_api_stubs/_draft/data_type_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def astype(
- Otherwise, ``x`` should be cast to a data type of that kind, according to the type promotion rules (see :ref:`type-promotion`) and the above notes.

- Kinds must be interpreted as the lowest-precision standard data type of that kind for the purposes of type promotion. For example, ``astype(x, 'complex floating')`` will return an array with the data type ``complex64`` when ``x.dtype`` is ``float32``, since ``complex64`` is the result of promoting ``float32`` with the lowest-precision standard complex data type, ``complex64``.
- Where type promotion is unspecified and thus implementation-specific, the result is also unspecified. For example, ``astype(x, 'complex floating')``, where ``x`` has data type ``int32``.

The returned array must have the same shape as ``x``.

Expand Down
Loading
0