DEC C
Language Reference Manual


Previous Contents Index

9.6 Mathematics (<math.h>)

The <math.h> header file defines one macro and several mathematical functions. The functions take double arguments and return double-precision values.

The behavior of the functions in this header is defined for all representable values of their input arguments. Each function executes as if it were a single operation, without generating any externally visible exceptions.

For all functions, a domain error occurs if an input argument is outside the domain over which the mathematical function is defined. The description of each function lists any domain errors. On a domain error, the function returns an implementation-defined value; the value of the EDOM macro is stored in errno.

For all functions, a range error occurs if the result of the function cannot be represented as a double value. If the result overflows (the magnitude of the result is so large that it cannot be represented in an object of the specified type), the function returns the value of the macro HUGE_VAL, with the same sign (except for the tan function) as the correct value of the function; the value of the ERANGE macro is stored in errno. If the result underflows (the magnitude of the result is so small that it cannot be represented in an object of the specified type), the function returns 0; whether the value of the ERANGE macro is stored in errno is implementation-defined.

Macros

HUGE_VAL

Trigonometric Functions

double acos(doublex);

double asin(doublex);

double atan(doublex);

double atan2(doubley, double x);

double cos(doublex);

double sin(doublex);

double tan(doublex);

Hyperbolic Functions

double cosh(doublex);

double sinh(doublex);

double tanh(doublex);

Exponential and Logarithmic Functions

double exp(doublex);

double frexp(doublevalue, int *eptr);

double ldexp(doublex, int exp);

double log(doublex);

double log10(doublex);

double modf(doublevalue, double *iptr);

Power Functions

double pow(doublex, double y);

double sqrt(doublex);

Nearest Integer, Absolute Value, and Remainder Functions

double ceil(doublex);

double fabs(doublex);

double floor(doublex);

double fmod(doublex, double y);

9.7 Nonlocal Jumps (<setjmp.h>)

The <setjmp.h> header file contains declarations that provide a way to avoid the normal function call and return sequence, typically to permit an intermediate return from a nested function call.

Macro

int setjmp(jmp_buf env)

Type

jmp_buf

Function

9.8 Signal Handling (<signal.h>)

The <signal.h> header file declares a type and two functions and defines several macros for handling exception conditions that might be reported during program execution.

Type

sig_atomic_t

Macros


SIG_DFL
SIG_ERR
SIG_IGN

Functions

void (*signal(int sig, void (*handler) (int))) (int);


Any other signals are operating-system dependent.
If the request can be honored, the signal function returns the value of handler for the most recent call to signal for the specified signal sig. Otherwise, a value of SIG_ERR is returned and an implementation-defined positive value is stored in errno.

int raise(int sig);

9.9 Variable Arguments (<stdarg.h>)

The <stdarg.h> header file declares a type and defines three macros for advancing through a list of function arguments of varying number and type.

Type

va_list

Macros

void va_start(va_list ap, parmN);

type va_arg(va_list ap, type);

void va_end(va_list ap);

9.10 Common Definitions (<stddef.h>)

The <stddef.h> header file defines several types and macros, some of which are also defined in other header files.

Types

ptrdiff

size_t

wchar_t

Macros

NULL

offsetof(type, member-designator)

9.11 Standard Input/Output (<stdio.h>)

The <stdio.h> header file declares three types, several macros, and many functions for performing text input and output. A text stream consists of a sequence of lines; each line ends with a new-line character.

Types

size_t

FILE

fpos_t

Macros

NULL

_IOFBF
_IOLBF
_IONBF

BUFFSIZ

EOF

FOPEN_MAX

FILENAME_MAX

L_tmpnam

SEEK_CUR
SEEK_END
SEEK_SET

TMP_MAX

stderr
stdin
stdout

File Operation Functions

int remove(const char*filename);

int rename(const char*old, const char *new);

FILE*tmpfile(void);

FILE*tmpnam(void);

File Access Functions

int fclose(FILE*stream);

int fflush(FILE*stream);


Previous Next Contents Index