Data Types¶
Array API specification for supported data types.
A conforming implementation of the array API standard must provide and support the following data types.
bool¶
Boolean (True
or False
).
int8¶
An 8bit signed integer whose values exist on the interval [128, +127]
.
int16¶
A 16bit signed integer whose values exist on the interval [−32,767, +32,767]
.
int32¶
A 32bit signed integer whose values exist on the interval [−2,147,483,647, +2,147,483,647]
.
int64¶
A 64bit signed integer whose values exist on the interval [−9,223,372,036,854,775,807, +9,223,372,036,854,775,807]
.
uint8¶
An 8bit unsigned integer whose values exist on the interval [0, +255]
.
uint16¶
A 16bit unsigned integer whose values exist on the interval [0, +65,535]
.
uint32¶
A 32bit unsigned integer whose values exist on the interval [0, +4,294,967,295]
.
uint64¶
A 64bit unsigned integer whose values exist on the interval [0, +18,446,744,073,709,551,615]
.
float32¶
IEEE 754 singleprecision (32bit) binary floatingpoint number (see IEEE 7542019).
float64¶
IEEE 754 doubleprecision (64bit) binary floatingpoint number (see IEEE 7542019).
complex64¶
Singleprecision (64bit) complex floatingpoint number whose real and imaginary components must be IEEE 754 singleprecision (32bit) binary floatingpoint numbers (see IEEE 7542019).
complex128¶
Doubleprecision (128bit) complex floatingpoint number whose real and imaginary components must be IEEE 754 doubleprecision (64bit) binary floatingpoint numbers (see IEEE 7542019).
Note
IEEE 7542019 requires support for subnormal (a.k.a., denormal) numbers, which are useful for supporting gradual underflow. However, hardware support for subnormal numbers is not universal, and many platforms (e.g., accelerators) and compilers support toggling denormalsarezero (DAZ) and/or flushtozero (FTZ) behavior to increase performance and to guard against timing attacks.
Accordingly, subnormal behavior is left unspecified and, thus, implementationdefined. Conforming implementations may vary in their support for subnormal numbers.
Note
A conforming implementation of the array API standard may provide and support additional data types beyond those described in this specification.
Data Type Objects¶
Data types (“dtypes”) are objects which are used as dtype
specifiers in functions and methods (e.g., zeros((2, 3), dtype=float32)
).
Note
A conforming implementation may add additional methods or attributes to data type objects beyond those described in this specification.
Note
Implementations may provide other ways to specify data types (e.g., zeros((2, 3), dtype='f4')
) which are not described in this specification; however, in order to ensure portability, array library consumers are recommended to use data type objects as provided by specification conforming array libraries.
A conforming implementation of the array API standard must provide and support data type objects having the following attributes and methods.
Methods¶

Computes the truth value of 
Default Data Types¶
A conforming implementation of the array API standard must define the following default data types.
a default realvalued floatingpoint data type (either
float32
orfloat64
).a default complex floatingpoint data type (either
complex64
orcomplex128
).a default integer data type (either
int32
orint64
).a default array index data type (either
int32
orint64
).
The default realvalued floatingpoint and complex floatingpoint data types must be the same across platforms.
The default complex floatingpoint point data type should match the default realvalued floatingpoint data type. For example, if the default realvalued floatingpoint data type is float32
, the default complex floatingpoint data type must be complex64
. If the default realvalued floatingpoint data type is float64
, the default complex floatingpoint data type must be complex128
.
The default integer data type should be the same across platforms, but the default may vary depending on whether Python is 32bit or 64bit.
The default array index data type may be int32
on 32bit platforms, but the default should be int64
otherwise.
Note that it is possible that a library supports multiple devices, with not all those device types supporting the same data types. In this case, the default integer or floatingpoint data types may vary with device. If that is the case, the library should clearly warn about this in its documentation.
Note
The default data types should be clearly defined in a conforming library’s documentation.
Data Type Categories¶
For the purpose of organizing functions within this specification, the following data type categories are defined.
Note
Conforming libraries are not required to organize data types according to these categories. These categories are only intended for use within this specification.
Numeric Data Types¶
int8
, int16
, int32
, int64
, uint8
, uint16
, uint32
, uint64
, float32
, float64
, complex64
, and complex128
.
Realvalued Data Types¶
int8
, int16
, int32
, int64
, uint8
, uint16
, uint32
, uint64
, float32
, and float64
.
Integer Data Types¶
int8
, int16
, int32
, int64
, uint8
, uint16
, uint32
, and uint64
.
Floatingpoint Data Types¶
float32
, float64
, complex64
, and complex128
.
Realvalued Floatingpoint Data Types¶
float32
and float64
.
Complex Floatingpoint Data Types¶
complex64
and complex128
.
Boolean Data Types¶
bool
.