14
14
"uint_names" ,
15
15
"int_names" ,
16
16
"all_int_names" ,
17
- "float_names " ,
17
+ "real_float_names " ,
18
18
"real_names" ,
19
19
"complex_names" ,
20
20
"numeric_names" ,
21
21
"dtype_names" ,
22
22
"int_dtypes" ,
23
23
"uint_dtypes" ,
24
24
"all_int_dtypes" ,
25
- "float_dtypes " ,
25
+ "real_float_dtypes " ,
26
26
"real_dtypes" ,
27
27
"numeric_dtypes" ,
28
28
"all_dtypes" ,
@@ -98,8 +98,8 @@ def __repr__(self):
98
98
uint_names = ("uint8" , "uint16" , "uint32" , "uint64" )
99
99
int_names = ("int8" , "int16" , "int32" , "int64" )
100
100
all_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
103
103
complex_names = ("complex64" , "complex128" )
104
104
numeric_names = real_names + complex_names
105
105
dtype_names = ("bool" ,) + numeric_names
@@ -128,15 +128,15 @@ def _make_dtype_tuple_from_names(names: List[str]) -> Tuple[DataType]:
128
128
129
129
uint_dtypes = _make_dtype_tuple_from_names (uint_names )
130
130
int_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 )
132
132
all_int_dtypes = uint_dtypes + int_dtypes
133
- real_dtypes = all_int_dtypes + float_dtypes
133
+ real_dtypes = all_int_dtypes + real_float_dtypes
134
134
complex_dtypes = _make_dtype_tuple_from_names (complex_names )
135
135
numeric_dtypes = real_dtypes
136
136
if api_version > "2021.12" :
137
137
numeric_dtypes += complex_dtypes
138
138
all_dtypes = (xp .bool ,) + numeric_dtypes
139
- all_float_dtypes = float_dtypes
139
+ all_float_dtypes = real_float_dtypes
140
140
if api_version > "2021.12" :
141
141
all_float_dtypes += complex_dtypes
142
142
bool_and_all_int_dtypes = (xp .bool ,) + all_int_dtypes
@@ -147,7 +147,7 @@ def _make_dtype_tuple_from_names(names: List[str]) -> Tuple[DataType]:
147
147
"signed integer" : int_dtypes ,
148
148
"unsigned integer" : uint_dtypes ,
149
149
"integral" : all_int_dtypes ,
150
- "real floating" : float_dtypes ,
150
+ "real floating" : real_float_dtypes ,
151
151
"complex floating" : complex_dtypes ,
152
152
"numeric" : numeric_dtypes ,
153
153
}
@@ -164,7 +164,7 @@ def is_float_dtype(dtype):
164
164
# See https://github.com/numpy/numpy/issues/18434
165
165
if dtype is None :
166
166
return False
167
- valid_dtypes = float_dtypes
167
+ valid_dtypes = real_float_dtypes
168
168
if api_version > "2021.12" :
169
169
valid_dtypes += complex_dtypes
170
170
return dtype in valid_dtypes
@@ -173,7 +173,7 @@ def is_float_dtype(dtype):
173
173
def get_scalar_type (dtype : DataType ) -> ScalarType :
174
174
if dtype in all_int_dtypes :
175
175
return int
176
- elif dtype in float_dtypes :
176
+ elif dtype in real_float_dtypes :
177
177
return float
178
178
elif dtype in complex_dtypes :
179
179
return complex
@@ -245,7 +245,7 @@ class MinMax(NamedTuple):
245
245
if default_int not in int_dtypes :
246
246
warn (f"inferred default int is { default_int !r} , which is not an int" )
247
247
default_float = xp .asarray (float ()).dtype
248
- if default_float not in float_dtypes :
248
+ if default_float not in real_float_dtypes :
249
249
warn (f"inferred default float is { default_float !r} , which is not a float" )
250
250
if api_version > "2021.12" :
251
251
default_complex = xp .asarray (complex ()).dtype
@@ -346,7 +346,7 @@ def result_type(*dtypes: DataType):
346
346
category_to_dtypes = {
347
347
"boolean" : (xp .bool ,),
348
348
"integer" : all_int_dtypes ,
349
- "floating-point" : float_dtypes ,
349
+ "floating-point" : real_float_dtypes ,
350
350
"numeric" : numeric_dtypes ,
351
351
"integer or boolean" : bool_and_all_int_dtypes ,
352
352
}
@@ -360,7 +360,7 @@ def result_type(*dtypes: DataType):
360
360
dtypes = category_to_dtypes [dtype_category ]
361
361
func_in_dtypes [name ] = dtypes
362
362
# 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
364
364
365
365
366
366
func_returns_bool = {
@@ -500,7 +500,7 @@ def result_type(*dtypes: DataType):
500
500
func_in_dtypes ["__bool__" ] = (xp .bool ,)
501
501
func_in_dtypes ["__int__" ] = all_int_dtypes
502
502
func_in_dtypes ["__index__" ] = all_int_dtypes
503
- func_in_dtypes ["__float__" ] = float_dtypes
503
+ func_in_dtypes ["__float__" ] = real_float_dtypes
504
504
func_in_dtypes ["from_dlpack" ] = numeric_dtypes
505
505
func_in_dtypes ["__dlpack__" ] = numeric_dtypes
506
506
0 commit comments