Skip to content

Commit e737dcd

Browse files
committed
Add dtype to the output of array_api finfo and iinfo
Original NumPy Commit: 00ca84141e708d382c5be2c3888c48a96a54244c
1 parent 88f46fa commit e737dcd

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

array_api_strict/_data_type_functions.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,15 @@ class finfo_object:
9090
max: float
9191
min: float
9292
smallest_normal: float
93+
dtype: Dtype
9394

9495

9596
@dataclass
9697
class iinfo_object:
9798
bits: int
9899
max: int
99100
min: int
101+
dtype: Dtype
100102

101103

102104
def finfo(type: Union[Dtype, Array], /) -> finfo_object:
@@ -114,6 +116,7 @@ def finfo(type: Union[Dtype, Array], /) -> finfo_object:
114116
float(fi.max),
115117
float(fi.min),
116118
float(fi.smallest_normal),
119+
fi.dtype,
117120
)
118121

119122

@@ -124,7 +127,7 @@ def iinfo(type: Union[Dtype, Array], /) -> iinfo_object:
124127
See its docstring for more information.
125128
"""
126129
ii = np.iinfo(type)
127-
return iinfo_object(ii.bits, ii.max, ii.min)
130+
return iinfo_object(ii.bits, ii.max, ii.min, ii.dtype)
128131

129132

130133
# Note: isdtype is a new function from the 2022.12 array API specification.

0 commit comments

Comments
 (0)