This section describes the trigonometric and hyperbolic functions for the data typecomplex.
#include <complex.h>
class complex
{
public:
friend complex sin(complex);
friend complex cos(complex);
friend complex sinh(complex);
friend complex cosh(complex);
};
complex y = sin(complex x)
Returns the sine of x.
complex y = cos(complex x)
Returns the cosine of x.
complex y = sinh(complex x)
Returns the hyperbolic sine of x.
complex y = cosh(complex x)
Returns the hyperbolic cosine of x.
RETURN VALUES
This section describes the trigonometric and hyperbolic functions for the data type complex. #include <complex.h> class complex public: friend complex sin(complex); friend complex sinh(complex); }; | |
complex y = sin(complex x) Returns the sine of x. complex y = cos(complex x) Returns the cosine of x. complex y = sinh(complex x) Returns the hyperbolic sine of x. complex y = cosh(complex x) Returns the hyperbolic cosine of x. | |
RETURN VALUES | |
If the imaginary part of x causes an overflow, sinh and cosh return (0.0, 0.0). When the real part is large enough to cause an overflow, sinh and cosh return:
In all these cases, errno is set to ERANGE. | |
EXAMPLE | The following program prints a range of complex numbers with their associated cosh() values: #include <iostream.h> #include <complex.h> main() { complex c; while (norm(c) < 10.0) { cout << c <<" " <<cosh(c) << "\n"; c += complex(1.0, 1.0); } return 0; } The result of executing the program is: ( 0, 0) ( 1, 0) ( 1, 1) ( 0.83373, 0.988898) ( 2, 2) ( -1.56563, 3.29789) % CCM0998 CPU time used: 0.0017 seconds Note The result of the cosh() function is a complex object. The constants of type double (e.g. 10.0, 1.0 etc) are used to construct complex numbers. |
SEE ALSO | |