Previous | Contents | Index |
#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.
The <errno.h> header file defines several macros used for error reporting.
EDOM
ERANGE
Error codes that can be stored in errno . They expand to integral constant expressions with unique nonzero values.
errno
An external variable or a macro that expands to a modifiable lvalue with type int , depending on the operating system.
The errno variable is used for holding implementation-defined error codes from library routines. All error codes are positive integers. The value of errno is 0 at program startup, but is never set to 0 by any library function. Therefore, errno should be set to 0 before calling a library function and then inspected afterward.
The
<limits.h>
and
<float.h>
header files define several macros that expand to various
implementation-specific limits and parameters, most of which describe
integer and floating-point properties of the hardware. See your
platform-specific Compaq C documentation for details.
9.6 Localization (<locale.h>)
The <locale.h> header file declares two functions and one type and defines several macros.
A structure containing members relating to the formatting of numeric values. The structure contains the following members in any order, with values shown in the comments:
char *decimal_point; /* "." */ char *thousands_sep; /* "" */ char *grouping; /* "" */ char *int_curr_symbol; /* "" */ char *currency_symbol; /* "" */ char *mon_decimal_point; /* "" */ char *mon_thousands_sep; /* "" */ char *mon_grouping; /* "" */ char *positive_sign; /* "" */ char *negative_sign; /* "" */ char int_frac_digits; /* CHAR_MAX */ char frac_digits; /* CHAR_MAX */ char p_cs_precedes; /* CHAR_MAX */ char p_sep_by_space; /* CHAR_MAX */ char n_cs_precedes; /* CHAR_MAX */ char n_sep_by_space; /* CHAR_MAX */ char p_sign_posn; /* CHAR_MAX */ char n_sign_posn; /* CHAR_MAX */
These members are described under the localeconv function in this section.
NULL
LC_ALL
LC_COLLATE
LC_CTYPE
LC_MONETARY
LC_NUMERIC
LC_TIME
Expand to integral constant expressions with distinct values, and can be used as the first argument to the setlocale function.
char *setlocale(int category, const char *locale);
Selects the appropriate portion of the program's locale as specified by the category and locale arguments. This function can be used to change or query the program's entire current locale or portions thereof.
The following values can be specified for the category argument:LC_ALL---affects the program's entire locale.
LC_COLLATE---affects the behavior of the strcoll and strxfrm functions.
LC_CTYPE---affects the behavior of the character-handling functions and multibyte functions.
LC_MONETARY---affects the monetary-formatting information returned by the localeconv function.
LC_NUMERIC---affects the decimal-point character for the formatted I/O functions and string-conversion functions, as well as the nonmonetary formatting information returned by the localeconv function.
LC_TIME---affects the behavior of the strftime function.
The following values can be specified for the locale argument:
- "C"---specifies the minimal environment for C translation
- ""---specifies the use of the environment variable corresponding to category. If this environment variable is not set, the LANG environment variable is used. If LANG is not set, an error is returned.
At program startup, the equivalent of the following is executed:
setlocale(LC_ALL, "C");
The setlocale function returns one of the following:
- If a pointer to a string is specified for locale and the selection can be honored, setlocale returns a pointer to the string associated with the specified category for the new locale. If the selection cannot be honored, setlocale returns a null pointer and the program's locale is not changed.
- If a null pointer is specified for locale, setlocale returns a pointer to the string associated with the category for the program's current locale. The program's locale is not changed.
In either case, the returned pointer to the string is such that a subsequent call with that string value and its associated category will restore that part of the program's locale. This string must not be modified by the program, but it can be overwritten by subsequent calls to setlocale .
struct lconv *localeconv(void);
Sets the components of an object with type struct lconv with values appropriate for formatting numeric quantities according to the rules of the current locale.
The structure members with type char * are pointers to strings, any of which (except decimal_point ) can point to "", which indicates that the value has zero length or is not available in the current locale. Structure members of type char are nonnegative numbers, any of which can be CHAR_MAX to indicate that the value is not available in the current locale. Structure members include the following:char *decimal_pointThe decimal-point character used to format nonmonetary quantities.
char *thousands_sepThe character used to separate groups of digits before the decimal point in formatted nonmonetary quantities.
char *groupingA string whose elements indicate the size of each group of digits in formatted nonmonetary quantities.
char *int_curr_symbolThe international currency symbol applicable to the current locale. The first three characters contain the alphabetic international currency symbol in accordance with those specified in ISO 4217 Codes for the Representation of Currency and Funds. The fourth character (immediately preceding the null character) is the character used to separate the international currency symbol from the monetary quantity.
char *currency_symbolThe local currency symbol applicable to the current locale.
char *mon_decimal_pointThe decimal-point character used to format monetary quantities.
char *mon_thousands_sepThe character used to separate groups of digits before the decimal point in formatted monetary quantities.
char *mon_groupingA string whose elements indicate the size of each group of digits in formatted monetary quantities.
char *positive_signThe string used to indicate a nonnegative formatted monetary quantity.
char *negative_signThe string used to indicate a negative formatted monetary quantity.
char int_frac_digitsThe number of fractional digits to be displayed in internationally formatted monetary quantities.
char frac_digitsThe number of fractional digits to be displayed in formatted monetary quantities.
char p_cs_precedesSet to 1 if the currency_symbol precedes the value for a nonnegative formatted monetary quantity; set to 0 if the currency_symbol follows the value.
char p_sep_by_spaceSet to 1 if the currency_symbol is separated by a space from the value for a nonnegative formatted monetary quantity; set to 0 if there is no space.
char n_cs_precedesSet to 1 if the currency_symbol precedes the value for a negative formatted monetary quantity; set to 0 if the currency_symbol follows the value.
char n_sep_by_spaceSet to 1 if the currency_symbol is separated by a space from the value for a negative formatted monetary quantity; set to 0 if there is no space.
char p_sign_posnSet to a value indicating the positioning of the positive_sign for a nonnegative formatted monetary quantity.
char n_sign_posnSet to a value indicating the positioning of the negative_sign for a negative formatted monetary quantity.
The elements of grouping and mon_grouping are interpreted according to the following:
- CHAR_MAX ---no further grouping is to be performed.
- 0---the previous element is to be repeatedly used for the remainder of the digits.
- other---the integer value is the number of digits that comprise the current group. The next element is examined to determine the size of the next group of digits before the current group.
The value of p_sign_posn and n_sign_posn is interpreted as follows:
- 0---parentheses surround the quantity and currency_symbol
- 1---the sign string precedes the quantity and currency_symbol
- 2---the sign string follows the quantity and currency_symbol
- 3---the sign string immediately precedes the currency_symbol
- 4---the sign string immediately follows the currency_symbol
The localeconv function returns a pointer to the filled in structure. The structure must not be modified by the program, but might be overwritten by subsequent calls to localeconv or to setlocale with categories LC_ALL , LC_MONETARY , or LC_NUMERIC .
Previous | Next | Contents | Index |