Skip to content

Commit e792e6c

Browse files
committed
DOC: Clarified how finfo works with complex numbers (numpy#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]
1 parent 71155e9 commit e792e6c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

numpy/core/getlimits.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,8 @@ class finfo:
423423
Parameters
424424
----------
425425
dtype : float, dtype, or instance
426-
Kind of floating point data-type about which to get information.
426+
Kind of floating point or complex floating point
427+
data-type about which to get information.
427428
428429
See Also
429430
--------
@@ -445,6 +446,11 @@ class finfo:
445446
fill the gap between 0 and ``smallest_normal``. However, subnormal numbers
446447
may have significantly reduced precision [2]_.
447448
449+
This function can also be used for complex data types as well. If used,
450+
the output will be the same as the corresponding real float type
451+
(e.g. numpy.finfo(numpy.csingle) is the same as numpy.finfo(numpy.single)).
452+
However, the output is true for the real and imaginary components.
453+
448454
References
449455
----------
450456
.. [1] IEEE Standard for Floating-Point Arithmetic, IEEE Std 754-2008,

0 commit comments

Comments
 (0)