[Python-Dev] PEP 485: math.isclose() (original) (raw)
Chris Barker chris.barker at noaa.gov
Mon May 25 08:45:04 CEST 2015
- Previous message (by thread): [Python-Dev] PEP 485: math.isclose()
- Next message (by thread): [Python-Dev] PEP 485: math.isclose()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
And a few comments on the patch ( I have not idea how to patch a patch...) Is there a branch somewhere with this patch applied?
I'm going through PEP 7, and cleaned up the docstring a bit:
diff -r 15af4f58d143 Modules/mathmodule.c --- a/Modules/mathmodule.c Sun May 24 22:27:00 2015 -0700 +++ b/Modules/mathmodule.c Sun May 24 22:57:52 2015 -0700 @@ -2051,8 +2051,8 @@ }
PyDoc_STRVAR(math_isclose_doc, -"Determine if two floating point numbers are in value\n\n"
+"is_close(a, b, rel_tol, abs_tol) -> bool\n\n" +"Determine if two floating point numbers are similar in value\n\n" "Returns True if a is close in value to b. False otherwise\n\n" ":param a: one of the values to be tested\n\n" ":param b: the other value to be tested\n\n"
and there is a missing space in the docs:
in math.rst:
Return True
if the values a and b are close to each other and
False
otherwise.
need a space between "each" and "other"
But it all looks good otherwise -- thanks!
-Chris
On Sun, May 24, 2015 at 9:53 PM, Chris Barker <chris.barker at noaa.gov> wrote:
I don't think I have permissions to comment on the issue,so I'm posting here. If there is a way for me to post to the issue, someone let me know...
In the issue (http://bugs.python.org/issue24270) Tal wrote """ I have a question regarding complex values. The code (from Chris Barker) doesn't support complex values (only things that can be converted into doubles). However, the PEP states the following under "Non-float types": "complex : for complex, the absolute value of the complex values will be used for scaling and comparison. If a complex tolerance is passed in, the absolute value will be used as the tolerance." """ right -- that was written before it was decided that isclose() needed to be written in C -- the python version supported that. """ Should math.isclose() support complex values? """ nope -- the math module is all about floats. """ Should an equivalent function be added to cmath? """ I think so -- lets see if we can do that in time for 3.5 -- but first get the float one done. """ Should we just leave things as they are and remove mention of complex values from the PEP (it isn't mentioned in the docs)? """ I'll update the PEP. -Chris
-- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker at noaa.gov
--
Christopher Barker, Ph.D. Oceanographer
Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker at noaa.gov -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20150524/c7cc31d5/attachment.html>
- Previous message (by thread): [Python-Dev] PEP 485: math.isclose()
- Next message (by thread): [Python-Dev] PEP 485: math.isclose()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]