HP-UX Reference (11i v1 05/09) - 3 Library Functions A-M (vol 6)
l
log2(3M) log2(3M)
NAME
log2(), log2f() - logarithm base two functions
SYNOPSIS
#include <math.h>
double log2(double x);
float log2f(float x);
DESCRIPTION
log2() returns the logarithm base two of x. The value of x must be greater than zero.
The ISO/ANSI C committee has approved the
log2() function for inclusion in the C9X draft standard.
log2f() is a float version of log2()
; it takes a float argument and returns a float result.
log2f() is not specified by any standard, but it is named in accordance with the conventions specified in
the "Future Library Directions" section of the ANSI C standard.
To use these functions, compile either with the default -Ae option or with the -Aa
and
-D_HPUX_SOURCE options. Make sure your program includes <
math.h>. Link in the math library by
specifying
-lm on the compiler or linker command line.
RETURN VALUE
If x is +INFINITY, log2() returns +INFINITY.
If x is zero,
log2() returns −HUGE_VAL.
If x is NaN, log2() returns NaN.
If x is less than zero, log2() returns NaN and sets errno to [EDOM].
ERRORS
If
log2() fails, errno is set to the following value.
[EDOM] x is less than zero.
SEE ALSO
cbrt(3M), exp(3M), log(3M), log10(3M), log1p(3M), pow(3M), sqrt(3M), math(5).
HP-UX 11i Version 1: September 2005 − 1 − Hewlett-Packard Company Section 3−−533