NAME
log2(), log2f(), log2l(), log2w(), log2q() — logarithm base two functions
SYNOPSIS
#include <math.h>
double log2(double x);
float log2f(float x);
HP Integrity Server Only
long double log2l(long double x);
extended log2w(extended x);
quad log2q(quad x);
DESCRIPTION
log2()
returns the logarithm base two of
x.
log2f()
is a
float
version of
log2();
it takes a
float
argument and returns a
float
result.
Integrity Server Only
log2l()
is a
long double
version of
log2();
it takes a
long double
argument and returns a
long double
result.
log2w()
is an
extended
version of
log2();
it takes an
extended
argument and returns an
extended
result.
log2q()
is equivalent to
log2l()
on HP-UX systems.
USAGE
To use these functions,
compile either with the default
-Ae
option or with the
-Aa
and
-D_HPUX_SOURCE
options.
To use (for Integrity servers)
log2w()
or
log2q(),
compile also with the
-fpwidetypes
option.
Make sure your program includes
<math.h>,
and link in the math library by specifying
-lm
on the compiler or linker command line.
For more information, see the
HP-UX floating-point guide for HP Integrity servers
at the following site:
http://www.hp.com/go/fp.
RETURN VALUE
If
x
is +INFINITY,
log2()
returns +INFINITY.
If
x
is zero,
log2()
returns
-HUGE_VAL
(equal to -INFINITY) and raises the divide-by-zero exception.
If
x
is less than zero,
log2()
returns NaN and raises the invalid exception.
If
x
is NaN,
log2()
returns NaN.
log2()
raises the
inexact exception whenever a rounded result does not equal the
mathematical result.
ERRORS
If
x
is less than zero,
log2()
sets
errno
to [EDOM].
Integrity Server Only
HP-UX
libm
functions on Integrity servers do not set
errno
by default. For
errno
setting, compile with the
+Olibmerrno
option.
STANDARDS CONFORMANCE
log2(),
log2f(),
log2l()
: ISO/IEC C99 (including Annex F, ``IEC 60559 floating-point arithmetic'')