MATH(7) BSD MATH(7)
NAME
math - math functions and constants
SYNOPSIS
#include <math.h>
DESCRIPTION
This file contains declarations of all the functions in the Math Library
(described in Section 3M), as well as various functions in the C Library
(Section 3C) that return floating-point values. It defines the following
constant, used as an error-return value:
HUGE_VAL A positive double expression. Although Domain/OS BSD
currently sets HUGE_VAL equal to FLT_MAX (see limits(5)),
HUGE_VAL may not be representable as a float in future
implementations.
If you require the HUGE macro to be a compile-time constant,
add the directive #define _CLASSIC_HUGE before any #include
directives. Programs compiled with _CLASSIC_HUGE are
forward-compatible only if linked with /usr/lib/crt0.o.
<math.h> makes the defining of built-in routines for fabs, sin, cos, tan,
log, exp, atan, atan2, and sqrt conditional upon your defining the
_MATH_BUILTINS macro. See intro(3).
Which matherr function your program invokes depends upon the startup
routine to which you link it. See matherr(3M).
If you compile with the -A nansi option (see cc(1)), <math.h> defines the
following mathematical constants for your convenience:
M_E The base of natural logarithms (e).
M_LOG2E The base-2 logarithm of e.
M_LOG10E The base-10 logarithm of e.
M_LN2 The natural logarithm of 2.
M_LN10 The natural logarithm of 10.
M_PI pi, the ratio of the circumference of a circle to its
diameter.
M_PI_2 pi/2.
M_PI_4 pi/4.
M_1_PI 1/pi.
M_2_PI 2/pi.
M_2_SQRTPI 2/\/pi.
M_SQRT2 The positive square root of 2.
M_SQRT1_2 The positive square root of 1/2.
If you don't compile with the -A nansi option, <math.h> will define these
constants for your program if it contains one of the following directives
(listed in order of increasing restrictiveness) before any #include
directive:
#define _APOLLO_SOURCE
#define _SYS5_SOURCE
#define _XOPEN_SOURCE
For the definitions of various machine-dependent "constants," see the
description of the <values.h> header file.
SEE ALSO
intro(3), matherr(3M)