From 88062b7feddcf3e8354c6857753523c2a80d864f Mon Sep 17 00:00:00 2001 From: Srinivas Vasudevan Date: Thu, 12 Dec 2019 01:56:54 +0000 Subject: Fix implementation of complex expm1. Add tests that fail with previous implementation, but pass with the current one. --- test/array_cwise.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'test/array_cwise.cpp') diff --git a/test/array_cwise.cpp b/test/array_cwise.cpp index ae0f9f97c..48ebcc88b 100644 --- a/test/array_cwise.cpp +++ b/test/array_cwise.cpp @@ -429,6 +429,11 @@ template void array_complex(const ArrayType& m) VERIFY_IS_APPROX(m1.exp(), exp(m1)); VERIFY_IS_APPROX(m1.exp() / m2.exp(),(m1-m2).exp()); + VERIFY_IS_APPROX(m1.expm1(), expm1(m1)); + VERIFY_IS_APPROX(expm1(m1), exp(m1) - 1.); + // Check for larger magnitude complex numbers that expm1 matches exp - 1. + VERIFY_IS_APPROX(expm1(10. * m1), exp(10. * m1) - 1.); + VERIFY_IS_APPROX(sinh(m1), 0.5*(exp(m1)-exp(-m1))); VERIFY_IS_APPROX(cosh(m1), 0.5*(exp(m1)+exp(-m1))); VERIFY_IS_APPROX(tanh(m1), (0.5*(exp(m1)-exp(-m1)))/(0.5*(exp(m1)+exp(-m1)))); -- cgit v1.2.3