From 59b707c2ac52e0d312f18f7c3ce62e7551270b18 Mon Sep 17 00:00:00 2001 From: LeeBeomsu Date: Thu, 30 Sep 2021 21:46:25 +0900 Subject: [PATCH] add asinh function to cmath Signed-off-by: LeeBeomsu --- Lib/test/test_cmath.py | 4 ++-- vm/src/stdlib/cmath.rs | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_cmath.py b/Lib/test/test_cmath.py index 0f4d1c743..080d31c95 100644 --- a/Lib/test/test_cmath.py +++ b/Lib/test/test_cmath.py @@ -56,8 +56,8 @@ 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' - # 'exp','acos','asin','asinh', + 'sin','cos','log','log10','sqrt','acosh','tan','tanh','asinh' + # 'exp','acos','asin', # 'atan','atanh','sinh','cosh' ]] # test first and second arguments independently for 2-argument log diff --git a/vm/src/stdlib/cmath.rs b/vm/src/stdlib/cmath.rs index 6e28ec333..18be58304 100644 --- a/vm/src/stdlib/cmath.rs +++ b/vm/src/stdlib/cmath.rs @@ -120,6 +120,12 @@ mod cmath { z.to_complex().tanh() } + /// Return the inverse hyperbolic sine of z. + #[pyfunction] + fn asinh(z: IntoPyComplex) -> Complex64 { + z.to_complex().asinh() + } + #[derive(FromArgs)] struct IsCloseArgs { #[pyarg(positional)]