RustPython: Implement missing `cmath` functions
The following functions are currently missing:
-
acos -
acosh -
asin -
asinh -
atan -
atanh -
cos -
cosh -
exp -
log -
log10 -
sin -
sinh -
sqrt -
tan -
tanh
Inspiration for how their implementation might look can be found in Modules/cmathmodule.c (and Modules/clinic/cmathmodule.c.h for argument parsing) of the CPython codebase. Lib/src/stdlib/math.rs equivalent functions should also be roughly similar.
Note to contributors: due to the way tests are organized, you’ll need to add your function to the list of tested functions in the test_functions class attribute of CMathTests (on line 58 in Lib/tests/test_cmath.py). I.e, if you want to add log, add it
alphabetically at the list used in the comprehension:
# add it to the list
test_functions = [getattr(cmath, fname) for fname in ['cos', ..., 'log', 'sqrt']]
If anyone wants to pick a function or two up, leave a comment naming the functions so other people can see who’s working on what. Hopefully that will minimize conflicts.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 38 (30 by maintainers)
I actually just finished both and was going to submit the PR if that’s okay
@DimitrisJim Hey I made a pull request would you please review it?
Thank you all!
@emhagman great, work on them!
@DimitrisJim I’d like to work on
sinhandcoshif possible!The good news is that we can rely on methods from the
num-complexcrate for pretty much all of these.