summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorMatteo Raso <mraso@uoguelph.ca>2022-09-14 19:05:29 -0400
committerMatteo Raso <mraso@uoguelph.ca>2022-09-14 19:05:29 -0400
commite792e6c58241b6e1576c3002a076b96e9f8ff21e (patch)
tree0cb23e44616f8bd7242f4536a88f66f75776959d /numpy
parent71155e9331cd30dbb37732a74fca5f23ab734aa4 (diff)
downloadnumpy-e792e6c58241b6e1576c3002a076b96e9f8ff21e.tar.gz
DOC: Clarified how finfo works with complex numbers (#22260)
There was some confusion about how finfo works with complex numbers, leading to an issue being made requesting that numpy either adds a cinfo function or changes the documentation of finfo. The submitter of that issue also linked to an issue for a seperate repository, which also included conversation about the proposed change. (github.com/data-apis/array-api/issues/433) In both discussions, there was a general concensus that it would be better to change the documentation to explain how finfo works instead of creating a cinfo function. Since this is just a small documentation change, there's no need to run the normal checks. [skip ci]
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/getlimits.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/numpy/core/getlimits.py b/numpy/core/getlimits.py
index 4149a5303..b6f65f848 100644
--- a/numpy/core/getlimits.py
+++ b/numpy/core/getlimits.py
@@ -423,7 +423,8 @@ class finfo:
Parameters
----------
dtype : float, dtype, or instance
- Kind of floating point data-type about which to get information.
+ Kind of floating point or complex floating point
+ data-type about which to get information.
See Also
--------
@@ -445,6 +446,11 @@ class finfo:
fill the gap between 0 and ``smallest_normal``. However, subnormal numbers
may have significantly reduced precision [2]_.
+ This function can also be used for complex data types as well. If used,
+ the output will be the same as the corresponding real float type
+ (e.g. numpy.finfo(numpy.csingle) is the same as numpy.finfo(numpy.single)).
+ However, the output is true for the real and imaginary components.
+
References
----------
.. [1] IEEE Standard for Floating-Point Arithmetic, IEEE Std 754-2008,