Chapter Contents |
Previous |
Next |
log2 |
Portability: | C99 |
SYNOPSIS | |
DESCRIPTION | |
RETURN VALUE | |
DIAGNOSTICS | |
RELATED FUNCTIONS | |
SEE ALSO |
SYNOPSIS |
#include <math.h> double log2(double x); float log2f(float x); long double log2l(long double x);
DESCRIPTION |
log2
computes the binary
(base 2) logarithm of its argument x
. x
must be greater than zero.
The function name log2f
should be used
for float
arguments, and log2l
for long double
arguments.
Alternately, if the header file tgmath.h
is
included, log2
may be used with any numeric
argument type.
RETURN VALUE |
log2
returns the binary
(base 2) logarithm of its argument, provided this value is defined and expressible.
DIAGNOSTICS |
If the argument of log2
is invalid, it returns -HUGE_VAL
in hexadecimal
floating point, or a NaN in binary floating point. In this case, the run-time
library writes an error message to the standard error file stderr
. log2(0.0)
returns
negative infinity in binary floating point.
If an error occurs in log2
, the _matherr
or
_matherb
routine
is called. You can supply your own version of _matherr
or _matherb
to suppress the diagnostic message
or modify the value returned.
RELATED FUNCTIONS |
exp2
, log
, _matherb
,
_matherr
SEE ALSO |
"Mathematical Functions" in Chapter 2, "Function Categories"
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright © 2004 by SAS Institute Inc., Cary, NC, USA. All rights reserved.