Skip to content

Implement cmath python module #228

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 9 commits into from
Mar 20, 2022
Merged

Implement cmath python module #228

merged 9 commits into from
Mar 20, 2022

Conversation

Smit-create
Copy link
Collaborator

y = exp(x)
y = log(x)
y = sqrt(x)
y = log10(x)
Copy link
Contributor

@certik certik Mar 14, 2022

Choose a reason for hiding this comment

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

Let's also test the results in y to make sure we are getting the right answer and not 0. I tested locally and it seems to work. I think we need to implement this in LPython first:

>>> y = 3+3j
>>> y
(3+3j)
>>> y.real
3.0
>>> y.imag
3.0

And absolute value for complex numbers:

>>> abs(y - (3+3j))
0.0
>>> abs(y - (3+3.001j))
0.0009999999999998899

So let's do it in subsequent PRs. See #229 and #230.

@certik certik merged commit 435792a into lcompilers:main Mar 20, 2022
@certik
Copy link
Contributor

certik commented Mar 20, 2022

This looks good, thanks! Let's get the real/imag parts of complex numbers working, so that we can add tests here that test the results.

@Smit-create
Copy link
Collaborator Author

Yep, sounds good!

@Smit-create Smit-create deleted the cmath1 branch March 20, 2022 18:33
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.

2 participants