From 472d825d90f96e6a4588ce85409571154492ebd5 Mon Sep 17 00:00:00 2001 From: Matthew Barber Date: Fri, 23 Sep 2022 10:20:09 +0100 Subject: [PATCH 1/2] Support complex dtypes in `finfo()` --- spec/API_specification/array_api/data_type_functions.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/spec/API_specification/array_api/data_type_functions.py b/spec/API_specification/array_api/data_type_functions.py index 3731e4c98..1ef859288 100644 --- a/spec/API_specification/array_api/data_type_functions.py +++ b/spec/API_specification/array_api/data_type_functions.py @@ -46,12 +46,15 @@ def can_cast(from_: Union[dtype, array], to: dtype, /) -> bool: def finfo(type: Union[dtype, array], /) -> finfo_object: """ - Machine limits for real-valued floating-point data types. + Machine limits for floating-point data types. Parameters ---------- type: Union[dtype, array] - the kind of real-valued floating-point data-type about which to get information. + the kind of floating-point data-type about which to get information. If complex, the information is about its component data type. + + .. note:: + Complex floating-point data types are specified to always use the same precision for both its real and imaginary components, so the information should be true for either component. Returns ------- From 311d902e57e076f69645a779fb04c33051dc0187 Mon Sep 17 00:00:00 2001 From: Matthew Barber Date: Fri, 23 Sep 2022 10:21:48 +0100 Subject: [PATCH 2/2] Clarify real-value for all returned attrs in `finfo()` --- .../API_specification/array_api/data_type_functions.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/API_specification/array_api/data_type_functions.py b/spec/API_specification/array_api/data_type_functions.py index 1ef859288..93b27cea8 100644 --- a/spec/API_specification/array_api/data_type_functions.py +++ b/spec/API_specification/array_api/data_type_functions.py @@ -63,23 +63,23 @@ def finfo(type: Union[dtype, array], /) -> finfo_object: - **bits**: *int* - number of bits occupied by the floating-point data type. + number of bits occupied by the real-valued floating-point data type. - **eps**: *float* - difference between 1.0 and the next smallest representable floating-point number larger than 1.0 according to the IEEE-754 standard. + difference between 1.0 and the next smallest representable real-valued floating-point number larger than 1.0 according to the IEEE-754 standard. - **max**: *float* - largest representable number. + largest representable real-valued number. - **min**: *float* - smallest representable number. + smallest representable real-valued number. - **smallest_normal**: *float* - smallest positive floating-point number with full precision. + smallest positive real-valued floating-point number with full precision. """ def iinfo(type: Union[dtype, array], /) -> iinfo_object: