Merge pull request #3175 from lijm1358/cmath-atan-atanh

Add `atanh` and `atan` to `cmath`
This commit is contained in:
Jeong YunWon
2021-10-01 01:52:09 +09:00
committed by GitHub
2 changed files with 14 additions and 2 deletions

View File

@@ -56,9 +56,9 @@ class CMathTests(unittest.TestCase):
#
# list of all functions in cmath
test_functions = [getattr(cmath, fname) for fname in [
'sin','cos','log','log10','sqrt','acosh','tan','tanh','asinh'
'sin','cos','log','log10','sqrt','acosh','tan','tanh','asinh', 'atan', 'atanh'
# 'exp','acos','asin',
# 'atan','atanh','sinh','cosh'
# 'sinh','cosh'
]]
# test first and second arguments independently for 2-argument log
# test_functions.append(lambda x : cmath.log(x, 1729. + 0j))

View File

@@ -108,6 +108,18 @@ mod cmath {
z.to_complex().acosh()
}
/// Return the inverse tangent of z.
#[pyfunction]
fn atan(z: IntoPyComplex) -> Complex64 {
z.to_complex().atan()
}
/// Return the inverse hyperbolic tangent of z.
#[pyfunction]
fn atanh(z: IntoPyComplex) -> Complex64 {
z.to_complex().atanh()
}
/// Return the tangent of z.
#[pyfunction]
fn tan(z: IntoPyComplex) -> Complex64 {