United States |
|
|
||
Chapter 9
|
#include <stddef.h> |
Each header file declares a set of related functions, as well as defining any types and macros needed for their use.
The standard headers are:
Header files can be included in any order. Each can be included more
than once in a given scope with no effect different from being included
once. However, the effect of including
<assert.h>
depends on the definition of
NDEBUG
. Include headers outside of any external declaration or definition,
and before any reference to the functions, types, or macros declared or
defined in the headers. If an identifier is declared or defined in more
than one included header, the second and subsequent headers containing
that identifier can be included after the initial reference to that
identifier.
9.1 Diagnostics (<assert.h>)
The header <assert.h> defines the assert macro and refers to another macro, NDEBUG , defined elsewhere. If NDEBUG is defined as a macro name at the point in the source file where <assert.h> is included, the assert macro is defined as follows:
#define assert(ignore) ((void) 0) |
void assert(int expression);
Puts diagnostics into programs. If expression is false (zero), the assert macro writes information about the particular call that failed on the standard error file in an implementation-defined format. It then calls the abort function. The assert macro returns no value.
The <complex.h> header file defines macros and declares functions that support complex arithmetic.
Each synopsis specifies a family of functions consisting of a principal function with one or more double complex parameters and a double complex or double return value; and other functions with the same name but with f and l suffixes which are corresponding functions with float and long double parameters and return values.
complex
Expands to _Complex .
_Complex_I
Expands to a constant expression of type const float _Complex , with the value of the imaginary unit. The imaginary unit is a number i such that i2 = --1.
imaginary
_Imaginary_I
Defined if and only if the implementation supports imaginary types; if defined, they expand to _Imaginary and a constant expression of type const float _Imaginary with the value of the imaginary unit.
I
Expands to _Imaginary_I or _Complex_I . If _Imaginary_I is not defined, I expands to _Complex_I .
#include <complex.h> double complex cacos(double complex z); float complex cacosf(float complex z); long double complex cacosl(long double complex z); |
The cacos functions compute the complex arc cosine of z, with branch cuts outside the interval [-1,+1] along the real axis.
The cacos functions return the value, in radians, of the complex arc cosine of z in the range of a strip mathematically unbounded along the imaginary axis and in the interval [0,Pi sign] along the real axis.
#include <complex.h> double complex casin(double complex z); float complex casinf(float complex z); long double complex casinl(long double complex z); |
The casin functions compute the complex arc sine of z, with branch cuts outside the interval [-1,+1] along the real axis.
The casin functions return the value, in radians, of the complex arc sine of z in the range of a strip mathematically unbounded along the imaginary axis and in the interval [-Pi sign/2,+Pi sign/2] along the real axis.
#include <complex.h> double complex catan(double complex z); float complex catanf(float complex z); long double complex catanl(long double complex z); |
The catan functions compute the complex arc tangent of z, with branch cuts outside the interval [-i,+i] along the imaginary axis.
The catan functions return the value, in radians, of the complex arc tangent of z in the range of a strip mathematically unbounded along the imaginary axis and in the interval [-Pi sign/2,+Pi sign/2] along the real axis.
#include <complex.h> double complex ccos(double complex z); float complex ccosf(float complex z); long double complex ccosl(long double complex z); |
The ccos functions return the complex cosine of z.
#include <complex.h> double complex csin(double complex z); float complex csinf(float complex z); long double complex csinl(long double complex z); |
The csin functions return the complex sine of z.
#include <complex.h> double complex ctan(double complex z); float complex ctanf(float complex z); long double complex ctanl(long double complex z); |
The ctan functions return the complex tangent of z.
#include <complex.h> double complex cacosh(double complex z); float complex cacoshf(float complex z); long double complex cacoshl(long double complex z); |
The cacosh functions compute the complex arc hyperbolic cosine of z, with a branch cut at values less than 1 along the real axis.
The cacosh functions return the value, in radians, of the complex arc hyperbolic cosine of z in the range of a a half-strip of non-negative values along the real axis and in the interval [-iPi sign,+iPi sign] along the imaginary axis.
#include <complex.h> double complex casinh(double complex z); float complex casinhf(float complex z); long double complex casinhl(long double complex z); |
The casinh functions compute the complex arc hyperbolic sine of z, with branch cuts outside the interval [-i,+i] along the imaginary axis.
The casinh functions return the complex arc hyperbolic sine value, in the range of a strip mathematically unbounded along the real axis and in the interval [-iPi sign/2,+iPi sign/2] along the imaginary axis.
#include <complex.h> double complex catanh(double complex z); float complex catanhf(float complex z); long double complex catanhl(long double complex z); |
The catanh functions compute the complex arc hyperbolic tangent of z, with branch cuts outside the interval [-1,+1] along the real axis.
The catanh functions return the complex arc hyperbolic tangent value, in the range of a strip mathematically unbounded along the real axis and in the interval [-iPi sign/2,+iPi sign/2] along the imaginary axis.
#include <complex.h> double complex ccosh(double complex z); float complex ccoshf(float complex z); long double complex ccoshl(long double complex z); |
The ccosh functions return the complex hyperbolic cosine of z.
#include <complex.h> double complex csinh(double complex z); float complex csinhf(float complex z); long double complex csinhl(long double complex z); |
The csinh functions return the complex hyperbolic sine of z.
#include <complex.h> double complex ctanh(double complex z); float complex ctanhf(float complex z); long double complex ctanhl(long double complex z); |
The ctanh functions return the complex hyperbolic tangent of z.
Exponential and Logarithmic Functions
#include <complex.h> double complex cexp(double complex z); float complex cexpf(float complex z); long double complex cexpl(long double complex z); |
The cexp functions return the complex base-e exponential of z.
#include <complex.h> double complex clog(double complex z); float complex clogf(float complex z); long double complex clogl(long double complex z); |
The clog functions compute the complex natural (base-e) logarithm of z, with a branch cut along the negative real axis.
The clog functions return the complex natural logarithm value, in the range of a strip mathematically unbounded along the real axis and in the interval [-iPi sign,+iPi sign] along the imaginary axis.
Power and Absolute-Value Functions
#include <complex.h> double cabs(double complex z); float cabsf(float complex z); long double cabsl(long double complex z); |
The cabs functions return the complex absolute value (also called norm, modulus, or magnitude) of z.
#include <complex.h> double complex cpow(double complex x, double complex y); float complex cpowf(float complex x, float complex y); long double complex cpowl(long double complex x, long double complex y); |
The cpow functions compute the complex power function xy, with a branch cut for the first parameter along the negative real axis.
The cpow functions return the complex power function value.
#include <complex.h> double complex csqrt(double complex z); float complex csqrtf(float complex z); long double complex csqrtl(long double complex z); |
The csqrt functions compute the complex square root of z, with a branch cut along the negative real axis.
The csqrt functions return the complex square root value, in the range of the right half-plane (including the imaginary axis).
#include <complex.h> double carg(double complex z); float cargf(float complex z); long double cargl(long double complex z); |
The carg functions compute the argument (also called phase angle) of z, with a branch cut along the negative real axis.
The carg functions return the value of the argument in the interval [-Pi sign,+Pi sign].
#include <complex.h> double cimag(double complex z); float cimagf(float complex z); long double cimagl(long double complex z); |
The cimag functions compute the imaginary part of z and return it as a real.
#include <complex.h> double complex conj(double complex z); float complex conjf(float complex z); long double complex conjl(long double complex z); |
The conj functions compute complex conjugate of z, by reversing the sign of its imaginary part.
The conj functions return the complex conjugate value.
#include <complex.h> double complex cproj(double complex z); float complex cprojf(float complex z); long double complex cprojl(long double complex z); |
The cproj functions compute a projection of z onto the Riemann sphere: z projects to z except that all complex infinities (even those with one infinite part and one NaN part) project to positive infinity on the real axis. If z has an infinite part, then cproj(z) is equivalent to:
INFINITY + I * copysign(0.0, cimag(z))
The cproj functions return the value of the projection onto the Riemann sphere.
#include <complex.h> double creal(double complex z); float crealf(float complex z); long double creall(long double complex z); |
The creal functions compute and return the real part of z.
For a variable z of complex type, z == creal(z) + cimag(z)*I.
The <ctype.h> header file declares several functions for testing characters. For each function, the argument is an int whose value must be EOF or representable as an unsigned char , and the return value is an integer.
Returns a nonzero integer if the character passed to it is an alphanumeric ASCII character. Otherwise, isalnum returns 0.
Returns a nonzero integer if the character passed to it is an alphabetic ASCII character. Otherwise, isalpha returns 0.
Returns a nonzero integer if the character passed to it is an ASCII DEL character (177 octal, 0x7F hex) or any nonprinting ASCII character (a code less than 40 octal, 0x20 hex). Otherwise, iscntrl returns 0.
Returns a nonzero integer if the character passed to it is a decimal digit character (0 to 9). Otherwise, isdigit returns 0.
Returns a nonzero integer if the character passed to it is a graphic ASCII character (any printing character except a space character). Otherwise, isgraph returns 0.
Returns a nonzero integer if the character passed to it is a lowercase alphabetic ASCII character. Otherwise, islower returns 0.
Returns a nonzero integer if the character passed to it is an ASCII printing character, including a space character. Otherwise, isprint returns 0.
Returns a nonzero integer if the character passed to it is an ASCII punctuation character (any printing character that is nonalphanumeric and greater than 40 octal, 0x20 hex). Otherwise, ispunct returns 0.
Returns a nonzero integer if the character passed to it is white space. Otherwise, isspace returns 0. The standard white space characters are:
- space (' ')
- form feed ('\f')
- new line ('\n')
- carriage return ('\r')
- horizontal tab ('\t')
- vertical tab ('\v')
Returns a nonzero integer if the character passed to it is an uppercase alphabetic ASCII character. Otherwise, isupper returns 0.
Returns a nonzero integer if the character passed to it is a hexadecimal digit (0 to 9, A to F, or a to f). Otherwise, isxdigit returns 0.
Converts an uppercase letter to lowercase. c remains unchanged if it is not an uppercase letter.
Converts a lowercase letter to uppercase. c remains unchanged if it is not a lowercase letter.
Previous | Next | Contents | Index |
privacy statement and legal notices |