-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add sinh and cosh to cmath implementation #3181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your work looks based on older version of our repository. Could you please rebase your work onto the current main branch?
Lib/test/test_cmath.py
Outdated
@requires_IEEE_754 | ||
def testSinhSign(self): | ||
for z in complex_zeros: | ||
self.assertComplexIdentical(cmath.sinh(z), z) | ||
|
||
@requires_IEEE_754 | ||
def testCoshSign(self): | ||
for z in complex_zeros: | ||
# since we are only dealing with complex zeros for the test | ||
# this is an easy way to get the imaginary sign | ||
imaginary = 0.0 * z.real * z.imag | ||
self.assertComplexIdentical(cmath.cosh(z), complex(1.0, imaginary)) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please avoid adding original codes to this file. If this tests are originated from CPython same file (Lib/test/test_cmath.py), separate the commit for this update and add CPython version to the commit message.
If you need these own tests, extra_tests/snippets/complex.py
would be the preferred place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked https://github.com/python/cpython/blob/main/Lib/test/test_cmath.py and the tests aren't there so I just removed them. I now understand what you mean, should be all set!
@DimitrisJim @youknowone I merged upstream, do you want me to rebase and force push? I usually just squash merge but I can do that as well. |
rebase is always preferred but this patch doesn't need commit history, so squash is also ok. Then please check the test part. Then everything will be perfect! |
@youknowone Awesome, sounds good. Will do! |
run fmt please (check the failed CI job) |
@youknowone Sorry just noticed and ran it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great, thanks!
This adds the
sinh
andcosh
methods for complex numbers. Adds two more to #3039