#include <math.h> double log(double x);
log
computes the natural log of its argument x
. The x
argument must be
a positive double-precision, floating-point number. The natural log is the
inverse of the exponential function.
log
returns the natural log of its argument x
, expressed as a
double-precision, floating-point number.
stderr
) if x
is a negative number or 0. In this case, the
function returns -HUGE_VAL
, the largest negative floating-point number
that can be represented.
If an error occurs in log
, the _matherr
routine is called. You
supply your own version of _matherr
to suppress the diagnostic
message or modify the value returned.
log
:
#include <math.h> #include <stdio.h> main() { double y, val; val = 10.0; y = log(val); printf("log(%f) = %fn", val, y); }
log10
, _matherr
Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.