Previous | Table of Contents | Next

Page 891

Part III:

Library Functions

Page 892

Intro

DESCRIPTION

This chapter describes all the library functions, excluding the library functions described in Part 2, which implement system calls. The various function groups are identified by a letter that is appended to the chapter number:

(3C) These functions—the functions from Chapter 2 and from Chapter 3S—are contained in the C standard library libc, which will be used by cc(1) by default.
(3S) These functions are parts of the stdio(3S) library. They are contained in the standard C library libc.
(3M) These functions are contained in the arithmetic library libm. They are used by the f77(1) FORTRAN compiler by default, but not by the cc(1) C compiler, which needs the option _lm.
(3F) These functions are part of the FORTRAN library libF77. There are no special compiler flags needed to use these functions.
(3X) Various special libraries. The manual pages documenting their functions specify the library names.

AUTHORS

Look at the header of the manual page for the author(s) and copyright conditions. Note that these can be different from page to page!

Linux, 13 December 1995

abort

abort—Causes abnormal program termination

SYNOPSIS

#include <stdlib.h>
void abort(void);

DESCRIPTION

The abort() function causes abnormal program termination unless the signal SIGABORT is caught and the signal handler does not return. If the abort() function causes program termination, all open streams are closed and flushed.

If the SIGABORT function is blocked or ignored, the abort() function will still override it.

RETURN VALUE

The abort() function never returns.

CONFORMS TO

SVID 3, POSIX, BSD 4.3, ISO 9899

SEE ALSO

sigaction(2), exit(3)

GNU, 12 April 1993

abs

abs—Computes the absolute value of an integer

Page 893

SYNOPSIS

#include <stdlib.h>
int abs(int j);

DESCRIPTION

The abs() function computes the absolute value of the integer argument j.

RETURN VALUE

Returns the absolute value of the integer argument.

CONFORMS TO

SVID 3, POSIX, BSD 4.3, ISO 9899

NOTES

Trying to take the absolute value of the most negative integer is not defined.

SEE ALSO

ceil(3), floor(3), fabs(3), labs(3), rint(3)

GNU, 6 June 1993

acos

acos—Arc cosine function

SYNOPSIS

#include <math.h>
double acos(double x);

DESCRIPTION

The acos() function calculates the arc cosine of x; that is the value whose cosine is x. If x falls outside the range _1 to 1, acos() fails and errno is set.

RETURN VALUE

The acos() function returns the arc cosine in radians; the value is mathematically defined to be between 0 and pi (inclusive).

ERRORS

EDOM               x is out of range.

CONFORMS TO

SVID 3, POSIX, BSD 4.3, ISO 9899

SEE ALSO

asin(3), atan(3), atan2(3), cos(3), sin(3), tan(3)

8 June 1993

acosh

acosh—Inverse hyperbolic cosine function

Page 894

SYNOPSIS

#include <math.h>
double acosh(double x);

DESCRIPTION

The acosh() function calculates the inverse hyperbolic cosine of x; that is the value whose hyperbolic cosine is x. If x is less than 1.0, acosh() returns not-a-number (NaN), and errno is set.

ERRORS

EDOM x is out of range.

CONFORMS TO

SVID 3, POSIX, BSD 4.3, ISO 9899

SEE ALSO

asinh(3), atanh(3), cosh(3), sinh(3), tanh(3)

13 June 1993

alloca

alloca—Memory allocator

SYNOPSIS

#include <stdlib.h>
void *alloca( size_t size);

DESCRIPTION

The alloca function allocates size bytes of space in the stack frame of the caller. This temporary space is automatically freed on return.

RETURN VALUES

The alloca function returns a pointer to the beginning of the allocated space. If the allocation fails, a NULL pointer is returned.

CONFORMS TO

There is evidence that the alloca function appeared in 32v, pwb, pwb.2, 3bsd, and 4bsd. There is a man page for it in BSD 4.3. Linux uses the GNU version.

BUGS

The alloca function is machine dependent.

SEE ALSO

brk(2), pagesize(2), calloc(3), malloc(3),
realloc(3)

GNU, 29 November 1993

asin

asin—Arc sine function

Page 895

SYNOPSIS

#include <math.h>
double asin(double x);

DESCRIPTION

The asin() function calculates the arc sine of x, which is the value whose sine is x. If x falls outside the range _1 to 1, asin() fails and errno is set.

RETURN VALUE

The asin() function returns the arc sine in radians, and the value is mathematically defined to be between -PI/2 and PI/2 (inclusive).

ERRORS

EDOM x is out of range.

CONFORMS TO

SVID 3, POSIX, BSD 4.3, ISO 9899

SEE ALSO

acos(3), atan(3), atan2(3), cos(3), sin(3), tan(3)

8 June 1993

asinh

asinh—Inverse hyperbolic sine function

SYNOPSIS

#include <math.h>
double asinh(double x);

DESCRIPTION

The asinh() function calculates the inverse hyperbolic sine of x—that is, the value whose hyperbolic sine is x.

CONFORMS TO

SVID 3, POSIX, BSD 4.3, ISO 9899

SEE ALSO

acosh(3), atanh(3), cosh(3), sinh(3), tanh(3)

13 June 1993

assert

assert—Abort the program if assertion is false

SYNOPSIS

#include <assert.h>
void assert (int expression);

Page 896

DESCRIPTION

assert() prints an error message to standard output and terminates the program by calling abort() if expression is false (that is, evaluates to 0). This only happens when the macro NDEBUG is undefined.

RETURN VALUE

No value is returned.

CONFORMS TO

ISO9899 (ANSI C)

BUGS

assert() is implemented as a macro; if the expression tested has side effects, program behavior will be different depending on whether NDEBUG is defined. This may create Heisenbugs, which go away when debugging is turned on.

SEE ALSO

exit(3), abort(3)

GNU, 4 April 1993

atan

atan—Arc tangent function

SYNOPSIS

#include <math.h>
double atan(double x);

DESCRIPTION

The atan() function calculates the arc tangent of x—that is, the value whose tangent is x.

RETURN VALUE

The atan() function returns the arc tangent in radians, and the value is mathematically defined to be between -PI/2 and PI/2 (inclusive).

CONFORMS TO

SVID 3, POSIX, BSD 4.3, ISO 9899

SEE ALSO

acos(3), asin(3), atan2(3), cos(3), sin(3), tan(3)

8 June 1993

atan2

atan2—Arc tangent function of two variables

SYNOPSIS

#include <math.h>
double atan2(double y, double x);

Previous | Table of Contents | Next

1