Mathematical Functions for Complex Floating Types
Functions
and macros for complex
numbers are declared in the header file
complex.h
(*). The functions shown in Table 1-34 have one parameter and return a value of type
double complex.
|
Mathematical function |
C function |
|
Trigonometric functions:
|
csin(), ccos(), ctan() casin(), cacos() catan() |
|
Hyperbolic functions |
csinh(), ccosh(), ctanh(), casinh(), cacosh(), catanh() |
|
Powers, square root |
cpow(), csqrt() |
|
Exponential function |
cexp() |
|
Logarithm |
clog() |
|
Complex conjugate |
conj() |
The functions shown in Table 1-35 have one
parameter of type double complex and return a
value of type double.
|
Mathematical function |
C function |
|
Absolute value |
cabs() |
|
Argument (phase angle) |
carg() |
|
Real and imaginary parts |
creal(), cimag() |
|
Projection onto the Riemann sphere |
cproj() |
These functions also have versions for float
complex and long double complex, with
names ending in f and l.
Table 1-36 shows macros that are defined for complex types.
|
Macro |
Replacement value |
complex |
_Complex |
_Complex_I |
The imaginary unit, i. e., the number |
imaginary |
_Imaginary |
_Imaginary_I |
The imaginary unit, with type |
I |
|
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access