From 438661dc449e1dd15caa35dc61b51506f2afd294 Mon Sep 17 00:00:00 2001 From: lijm1358 Date: Thu, 30 Sep 2021 23:13:58 +0900 Subject: [PATCH] Add atanh and atan to cmath --- Lib/test/test_cmath.py | 4 ++-- vm/src/stdlib/cmath.rs | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_cmath.py b/Lib/test/test_cmath.py index 080d31c95e..fb504c03c6 100644 --- a/Lib/test/test_cmath.py +++ b/Lib/test/test_cmath.py @@ -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)) diff --git a/vm/src/stdlib/cmath.rs b/vm/src/stdlib/cmath.rs index 18be58304d..e337510e20 100644 --- a/vm/src/stdlib/cmath.rs +++ b/vm/src/stdlib/cmath.rs @@ -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 {