ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
cos.php
Go to the documentation of this file.
1<?php
2
10namespace Complex;
11
19if (!function_exists(__NAMESPACE__ . '\\cos')) {
20 function cos($complex): Complex
21 {
22 $complex = Complex::validateComplexArgument($complex);
23
24 if ($complex->isReal()) {
25 return new Complex(\cos($complex->getReal()));
26 }
27
28 return conjugate(
29 new Complex(
30 \cos($complex->getReal()) * \cosh($complex->getImaginary()),
31 \sin($complex->getReal()) * \sinh($complex->getImaginary()),
32 $complex->getSuffix()
33 )
34 );
35 }
36}
An exception for terminatinating execution or to throw for unit testing.