Skip to content

Port implementations of math functions from cpython #153

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

Closed
windelbouwman opened this issue Oct 14, 2018 · 8 comments
Closed

Port implementations of math functions from cpython #153

windelbouwman opened this issue Oct 14, 2018 · 8 comments
Labels
E-help-wanted Extra attention is needed good first issue Good for newcomers

Comments

@windelbouwman
Copy link
Contributor

There are four math functions which are pretty complex.

  • math.erf
  • math.erfc
  • math.gamma
  • math.lgamma

They are implemented in cpython, as can be seen here:
https://github.com/python/cpython/blob/master/Modules/mathmodule.c#L113

The documentation is listed here:
https://docs.python.org/3/library/math.html#special-functions

In rust python, they must be implemented in vm/src/stdlib/math.rs.

@windelbouwman windelbouwman added E-help-wanted Extra attention is needed good first issue Good for newcomers labels Oct 14, 2018
@yodalee
Copy link
Contributor

yodalee commented Nov 23, 2018

Can we use Rust FFI to call C function to simplify the implementation?

@windelbouwman
Copy link
Contributor Author

That would be possible, but even in CPython no library is used, but a hand crafted implementation. If there is a rust library implementing these functions, that would be preferred.

@yodalee
Copy link
Contributor

yodalee commented Nov 24, 2018

I think we can use this: https://docs.rs/statrs/0.9.0/statrs/index.html

@windelbouwman
Copy link
Contributor Author

Okay, that looks indeed like it provides the right functions! Nice find!

@windelbouwman
Copy link
Contributor Author

@yodalee is this issue now completed, or do we require more actions?

@yodalee
Copy link
Contributor

yodalee commented Nov 27, 2018

I think this one is complete. If you want to add more function implementation, I think open another issue is better.

@alanjds
Copy link
Contributor

alanjds commented Jun 7, 2019

Is this able to be closed? Can someone please close it?

(I am trying to find good first issues for myself)

@coolreader18
Copy link
Member

Yes, it can be, thanks for the reminder. Have you tried running whats_left.sh in the root of the repo? It'll list a bunch of methods left to be implemented on builtin types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-help-wanted Extra attention is needed good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants