20 if (!function_exists(__NAMESPACE__ .
'\\tanh')) {
21 function tanh($complex):
Complex 23 $complex = Complex::validateComplexArgument($complex);
24 $real = $complex->getReal();
25 $imaginary = $complex->getImaginary();
26 $divisor = \cos($imaginary) * \cos($imaginary) + \sinh($real) * \sinh($real);
27 if ($divisor == 0.0) {
28 throw new \InvalidArgumentException(
'Division by zero');
32 \sinh($real) * \cosh($real) / $divisor,
33 0.5 * \sin(2 * $imaginary) / $divisor,