You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: spec/API_specification/data_types.md
+10
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,16 @@ A conforming implementation of the array API standard must provide and support t
8
8
9
9
A conforming implementation of the array API standard may provide and support additional data types beyond those described in this specification.
10
10
11
+
.. note::
12
+
13
+
These dtypes are objects that can be used as dtype specifiers in functions and methods (e.g., `zeros((2, 3), dtype=float32)`). A conforming implementation may add methods or attributes to dtype objects; these are not part of this specification however.
14
+
15
+
.. note::
16
+
17
+
Implementations may provide others ways to specify dtypes (e.g.,
18
+
`zeros((2, 3), dtype='f4')`); these are not part of this specification however.
Copy file name to clipboardExpand all lines: spec/API_specification/type_promotion.md
+22-11
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,11 @@ A conforming implementation of the array API standard must implement the followi
8
8
9
9
A conforming implementation of the array API standard may support additional type promotion rules beyond those described in this specification.
10
10
11
+
.. note::
12
+
13
+
Type codes are used here to keep tables readable, they are not part of the standard.
14
+
In code, use the dtype objects specified in :ref:`data-types` (e.g., `int16` rather than `'i2'`).
15
+
11
16
## Rules
12
17
13
18
<!-- Note: please keep table columns aligned -->
@@ -23,10 +28,10 @@ A conforming implementation of the array API standard may support additional typ
23
28
24
29
where
25
30
26
-
-**i1**: 8-bit signed integer
27
-
-**i2**: 16-bit signed integer
28
-
-**i4**: 32-bit signed integer
29
-
-**i8**: 64-bit signed integer
31
+
-**i1**: 8-bit signed integer (i.e., `int8`)
32
+
-**i2**: 16-bit signed integer (i.e., `int16`)
33
+
-**i4**: 32-bit signed integer (i.e., `int32`)
34
+
-**i8**: 64-bit signed integer (i.e., `int64`)
30
35
31
36
- unsigned integer type promotion table:
32
37
@@ -39,10 +44,10 @@ A conforming implementation of the array API standard may support additional typ
39
44
40
45
where
41
46
42
-
-**u1**: 8-bit unsigned integer
43
-
-**u2**: 16-bit unsigned integer
44
-
-**u4**: 32-bit unsigned integer
45
-
-**u8**: 64-bit unsigned integer
47
+
-**u1**: 8-bit unsigned integer (i.e., `uint8`)
48
+
-**u2**: 16-bit unsigned integer (i.e., `uint16`)
49
+
-**u4**: 32-bit unsigned integer (i.e., `uint32`)
50
+
-**u8**: 64-bit unsigned integer (i.e., `uint64`)
46
51
47
52
- mixed unsigned and signed integer type promotion table:
48
53
@@ -61,10 +66,16 @@ A conforming implementation of the array API standard may support additional typ
61
66
62
67
where
63
68
64
-
-**f4**: single-precision (32-bit) floating-point number
65
-
-**f8**: double-precision (64-bit) floating-point number
69
+
-**f4**: single-precision (32-bit) floating-point number (i.e., `float32`)
70
+
-**f8**: double-precision (64-bit) floating-point number (i.e., `float64`)
66
71
67
72
## Notes
68
73
69
74
- Type promotion rules **strictly** apply when determining the common result type for two **array** operands during an arithmetic operation, regardless of array dimension. Accordingly, zero-dimensional arrays are subject to the same type promotion rules as dimensional arrays.
70
-
- Non-array ("scalar") operands are **not** permitted to participate in type promotion.
75
+
- Non-array ("scalar") operands are **not** permitted to participate in type promotion.
76
+
77
+
78
+
.. note::
79
+
80
+
Mixed integer and floating-point type promotion rules are not specified
0 commit comments