Skip to content

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

Merged
merged 4 commits into from
Oct 1, 2021

Conversation

emhagman
Copy link
Contributor

@emhagman emhagman commented Oct 1, 2021

This adds the sinh and cosh methods for complex numbers. Adds two more to #3039

@DimitrisJim
Copy link
Member

Seems like you need to rebase to include recent changes (probably #3174 and #3175).

Copy link
Member

@youknowone youknowone left a 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?

Comment on lines 598 to 610
@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))

Copy link
Member

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.

Copy link
Contributor Author

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!

@emhagman
Copy link
Contributor Author

emhagman commented Oct 1, 2021

@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.

@youknowone
Copy link
Member

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!

@emhagman
Copy link
Contributor Author

emhagman commented Oct 1, 2021

@youknowone Awesome, sounds good. Will do!

@emhagman emhagman requested a review from youknowone October 1, 2021 14:55
@emhagman emhagman changed the title feat: add sinh and cosh to cmath Add sinh and cosh to cmath implementation Oct 1, 2021
@youknowone
Copy link
Member

run fmt please (check the failed CI job)

@emhagman
Copy link
Contributor Author

emhagman commented Oct 1, 2021

@youknowone Sorry just noticed and ran it

@DimitrisJim DimitrisJim dismissed youknowone’s stale review October 1, 2021 18:02

Review addressed.

Copy link
Member

@DimitrisJim DimitrisJim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great, thanks!

@DimitrisJim DimitrisJim merged commit 2a31646 into RustPython:main Oct 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants