Skip to content

Implement missing cmath functions #3039

@DimitrisJim

Description

@DimitrisJim

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions