tail head cat sleep
QR code linking to this page

Manual Pages  — MATH

NAME

math – floating-point mathematical library

CONTENTS

LIBRARY

Math Library (libm, -lm)

SYNOPSIS

#include <math.h>

DESCRIPTION

The math library includes the following components: <math.h><complex.h><tgmath.h><fenv.h>
The rest of this manual page describes the functions provided by <math.h>. Please consult
complex(3), tgmath(3), and fenv(3) for information on the other components.

LIST OF FUNCTIONS

Each of the following double functions has a float counterpart with an ‘f’ appended to the name and a long double counterpart with an ‘l’ appended. As an example, the float and long double counterparts of double acos(double x) are float acosf(float x) and long double acosl(long double x), respectively. The classification macros and silent order predicates are type generic and should not be suffixed with ‘f’ or ‘l’.

Algebraic Functions

Name
Description
cbrtcube root
fmafused multiply-add
hypotEuclidean distance
sqrtsquare root

Classification Macros

Name
Description
fpclassifyclassify a floating-point value
isfinitedetermine whether a value is finite
isinfdetermine whether a value is infinite
isnandetermine whether a value is NaN
isnormaldetermine whether a value is normalized

Exponent Manipulation Functions

Name
Description
frexpextract exponent and mantissa
ilogbextract exponent
ldexpmultiply by power of 2
logbextract exponent
scalblnadjust exponent
scalbnadjust exponent

Extremum- and Sign-Related Functions

Name
Description
copysigncopy sign bit
fabsabsolute value
fdimpositive difference
fmaxmaximum function
fminminimum function
signbitextract sign bit

Not a Number Functions

Name
Description
nangenerate a quiet NaN

Residue and Rounding Functions

Silent Order Predicates

Name
Description
isgreatergreater than relation
isgreaterequalgreater than or equal to relation
islessless than relation
islessequalless than or equal to relation
islessgreaterless than or greater than relation
isunorderedunordered relation

Transcendental Functions

Name
Description
acosinverse cosine
acoshinverse hyperbolic cosine
asininverse sine
asinhinverse hyperbolic sine
ataninverse tangent
atanhinverse hyperbolic tangent
atan2atan(y/x); complex argument
coscosine
coshhyperbolic cosine
erferror function
erfccomplementary error function
expexponential base e
exp2exponential base 2
expm1exp(x)-1
j0Bessel function of the first kind of the order 0
j1Bessel function of the first kind of the order 1
jnBessel function of the first kind of the order n
lgammalog gamma function
lognatural logarithm
log10logarithm to base 10
log1plog(1+x)
log2base 2 logarithm
powexponential x**y
sintrigonometric function
sinhhyperbolic function
tantrigonometric function
tanhhyperbolic function
tgammagamma function
y0Bessel function of the second kind of the order 0
y1Bessel function of the second kind of the order 1
ynBessel function of the second kind of the order n

The routines in this section might not produce a result that is correctly rounded, so reproducible results cannot be guaranteed across platforms. For most of these functions, however, incorrect rounding occurs rarely, and then only in very-close-to-halfway cases.

SEE ALSO

HISTORY

A math library with many of the present functions appeared in AT&T v7 . The library was substantially rewritten for BSD 4.3 to provide better accuracy and speed on machines supporting either VAX or IEEE 754 floating-point. Most of this library was replaced with FDLIBM, developed at Sun Microsystems, in FreeBSD 1.1.5 . Additional routines, including ones for float and long double values, were written for or imported into subsequent versions of FreeBSD.

BUGS

Many of the routines to compute transcendental functions produce inaccurate results in other than the default rounding mode.

On the i386 platform, trigonometric argument reduction is not performed accurately for huge arguments, resulting in large errors for such arguments to cos(), sin(), and tan().


MATH (3) December 7, 2017

QR code linking to this page


Please direct any comments about this manual page service to Ben Bullock. Privacy policy.

When people say "Drive safe!" I'm like no, a safe is for keeping money, I drive car.
— Artur Bagyants