1414 "uint_names" ,
1515 "int_names" ,
1616 "all_int_names" ,
17- "float_names " ,
17+ "real_float_names " ,
1818 "real_names" ,
1919 "complex_names" ,
2020 "numeric_names" ,
2121 "dtype_names" ,
2222 "int_dtypes" ,
2323 "uint_dtypes" ,
2424 "all_int_dtypes" ,
25- "float_dtypes " ,
25+ "real_float_dtypes " ,
2626 "real_dtypes" ,
2727 "numeric_dtypes" ,
2828 "all_dtypes" ,
@@ -98,8 +98,8 @@ def __repr__(self):
9898uint_names = ("uint8" , "uint16" , "uint32" , "uint64" )
9999int_names = ("int8" , "int16" , "int32" , "int64" )
100100all_int_names = uint_names + int_names
101- float_names = ("float32" , "float64" )
102- real_names = uint_names + int_names + float_names
101+ real_float_names = ("float32" , "float64" )
102+ real_names = uint_names + int_names + real_float_names
103103complex_names = ("complex64" , "complex128" )
104104numeric_names = real_names + complex_names
105105dtype_names = ("bool" ,) + numeric_names
@@ -128,15 +128,15 @@ def _make_dtype_tuple_from_names(names: List[str]) -> Tuple[DataType]:
128128
129129uint_dtypes = _make_dtype_tuple_from_names (uint_names )
130130int_dtypes = _make_dtype_tuple_from_names (int_names )
131- float_dtypes = _make_dtype_tuple_from_names (float_names )
131+ real_float_dtypes = _make_dtype_tuple_from_names (real_float_names )
132132all_int_dtypes = uint_dtypes + int_dtypes
133- real_dtypes = all_int_dtypes + float_dtypes
133+ real_dtypes = all_int_dtypes + real_float_dtypes
134134complex_dtypes = _make_dtype_tuple_from_names (complex_names )
135135numeric_dtypes = real_dtypes
136136if api_version > "2021.12" :
137137 numeric_dtypes += complex_dtypes
138138all_dtypes = (xp .bool ,) + numeric_dtypes
139- all_float_dtypes = float_dtypes
139+ all_float_dtypes = real_float_dtypes
140140if api_version > "2021.12" :
141141 all_float_dtypes += complex_dtypes
142142bool_and_all_int_dtypes = (xp .bool ,) + all_int_dtypes
@@ -147,7 +147,7 @@ def _make_dtype_tuple_from_names(names: List[str]) -> Tuple[DataType]:
147147 "signed integer" : int_dtypes ,
148148 "unsigned integer" : uint_dtypes ,
149149 "integral" : all_int_dtypes ,
150- "real floating" : float_dtypes ,
150+ "real floating" : real_float_dtypes ,
151151 "complex floating" : complex_dtypes ,
152152 "numeric" : numeric_dtypes ,
153153}
@@ -164,7 +164,7 @@ def is_float_dtype(dtype):
164164 # See https://github.com/numpy/numpy/issues/18434
165165 if dtype is None :
166166 return False
167- valid_dtypes = float_dtypes
167+ valid_dtypes = real_float_dtypes
168168 if api_version > "2021.12" :
169169 valid_dtypes += complex_dtypes
170170 return dtype in valid_dtypes
@@ -173,7 +173,7 @@ def is_float_dtype(dtype):
173173def get_scalar_type (dtype : DataType ) -> ScalarType :
174174 if dtype in all_int_dtypes :
175175 return int
176- elif dtype in float_dtypes :
176+ elif dtype in real_float_dtypes :
177177 return float
178178 elif dtype in complex_dtypes :
179179 return complex
@@ -245,7 +245,7 @@ class MinMax(NamedTuple):
245245 if default_int not in int_dtypes :
246246 warn (f"inferred default int is { default_int !r} , which is not an int" )
247247 default_float = xp .asarray (float ()).dtype
248- if default_float not in float_dtypes :
248+ if default_float not in real_float_dtypes :
249249 warn (f"inferred default float is { default_float !r} , which is not a float" )
250250 if api_version > "2021.12" :
251251 default_complex = xp .asarray (complex ()).dtype
@@ -346,7 +346,7 @@ def result_type(*dtypes: DataType):
346346category_to_dtypes = {
347347 "boolean" : (xp .bool ,),
348348 "integer" : all_int_dtypes ,
349- "floating-point" : float_dtypes ,
349+ "floating-point" : real_float_dtypes ,
350350 "numeric" : numeric_dtypes ,
351351 "integer or boolean" : bool_and_all_int_dtypes ,
352352}
@@ -360,7 +360,7 @@ def result_type(*dtypes: DataType):
360360 dtypes = category_to_dtypes [dtype_category ]
361361 func_in_dtypes [name ] = dtypes
362362# See https://github.com/data-apis/array-api/pull/413
363- func_in_dtypes ["expm1" ] = float_dtypes
363+ func_in_dtypes ["expm1" ] = real_float_dtypes
364364
365365
366366func_returns_bool = {
@@ -500,7 +500,7 @@ def result_type(*dtypes: DataType):
500500func_in_dtypes ["__bool__" ] = (xp .bool ,)
501501func_in_dtypes ["__int__" ] = all_int_dtypes
502502func_in_dtypes ["__index__" ] = all_int_dtypes
503- func_in_dtypes ["__float__" ] = float_dtypes
503+ func_in_dtypes ["__float__" ] = real_float_dtypes
504504func_in_dtypes ["from_dlpack" ] = numeric_dtypes
505505func_in_dtypes ["__dlpack__" ] = numeric_dtypes
506506
0 commit comments