log(3)


NAME

   log, logf, logl - natural logarithmic function

SYNOPSIS

   #include <math.h>

   double log(double x);
   float logf(float x);
   long double logl(long double x);

   Link with -lm.

   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):

   logf(), logl():
       _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
           || /* Since glibc 2.19: */ _DEFAULT_SOURCE
           || /* Glibc versions <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE

DESCRIPTION

   These functions return the natural logarithm of x.

RETURN VALUE

   On success, these functions return the natural logarithm of x.

   If x is a NaN, a NaN is returned.

   If x is 1, the result is +0.

   If x is positive infinity, positive infinity is returned.

   If  x  is  zero,  then  a  pole  error occurs, and the functions return
   -HUGE_VAL, -HUGE_VALF, or -HUGE_VALL, respectively.

   If x is negative (including negative infinity),  then  a  domain  error
   occurs, and a NaN (not a number) is returned.

ERRORS

   See  math_error(7) for information on how to determine whether an error
   has occurred when calling these functions.

   The following errors can occur:

   Domain error: x is negative
          errno is set  to  EDOM.   An  invalid  floating-point  exception
          (FE_INVALID) is raised.

   Pole error: x is zero
          errno   is  set  to  ERANGE.   A  divide-by-zero  floating-point
          exception (FE_DIVBYZERO) is raised.

ATTRIBUTES

   For  an  explanation  of  the  terms  used   in   this   section,   see
   attributes(7).

   
   Interface              Attribute      Value   
   
   log(), logf(), logl()  Thread safety  MT-Safe 
   

CONFORMING TO

   C99, POSIX.1-2001, POSIX.1-2008.

   The variant returning double also conforms to SVr4, 4.3BSD, C89.

BUGS

   In  glibc  2.5  and earlier, taking the log() of a NaN produces a bogus
   invalid floating-point (FE_INVALID) exception.

SEE ALSO

   cbrt(3), clog(3), log10(3), log1p(3), log2(3), sqrt(3)

COLOPHON

   This page is part of release 4.09 of the Linux  man-pages  project.   A
   description  of  the project, information about reporting bugs, and the
   latest    version    of    this    page,    can     be     found     at
   https://www.kernel.org/doc/man-pages/.

                              2016-03-15                            LOG(3)


More Linux Commands

manpages/twm.1.html
twm(1) - Tab Window Manager for the X Window System.........
Twm is a window manager for the X Window System. It provides titlebars, shaped windows, several forms of icon management, user-defined macro functions, click-to

manpages/XGetWMSizeHints.3.html
XGetWMSizeHints(3) - allocate size hints structure and set o
The XAllocSizeHints function allocates and returns a pointer to a XSizeHints structure. Note that all fields in the XSizeHints structure are initially set to ze

manpages/ffcfstress.1.html
ffcfstress(1) constant force stress test for force-feedback
ffcfstress stress tests constant non-enveloped forces on a force feedback device. It simulates a moving spring force by applying a frequently updated constant f

manpages/msgconv.1.html
msgconv(1) - character set conversion for message catalog...
Converts a translation catalog to a different character encoding. Mandatory arguments to long options are mandatory for short options too. Input file location:

manpages/wctype.3.html
wctype(3) - wide-character classification - Linux man page
The wctype_t type represents a property which a wide character may or may not have. In other words, it represents a class of wide characters. This types nature

manpages/snmptranslate.1.html
snmptranslate(1) - translate MIB OID names between numeric a
snmptranslate is an application that translates one or more SNMP object identifier values from their symbolic (textual) forms into their numerical forms (or vic

manpages/add_key.2.html
add_key(2) - Add a key to the kernel's key management facili
add_key() asks the kernel to create or update a key of the given type and description, instantiate it with the payload of length plen, and to attach it to the n

manpages/funzip.1.html
funzip(1) - filter for extracting from a ZIP archive in a pi
funzip without a file argument acts as a filter; that is, it assumes that a ZIP archive (or a gzipdaemon(3) file) is being piped into standard input, and it ext

manpages/pamtopfm.1.html
pamtopfm(1) - Convert Netpbm image to PFM (Portable Float Ma
This program is part of Netpbm(1) pamtopfm reads a Netpbm image (PNM or PAM) and converts it to a PFM (Portable Float Map) image. The PFM (Portable Float Map) i

manpages/waddstr.3ncurses.html
mvwaddstr(3ncurses) - add a string of characters to a curses
These functions write the (null-terminated) character string str on the given window. It is similar to calling waddch once for each character in the string. The

manpages/regshell.1.html
regshell(1) Windows registry file browser using readline....
regshell is a utility that lets you browse thru a Windows registry file as if you were using a regular unix shell to browse thru a file system. OPTIONS --help S

manpages/mvwinchstr.3ncurses.html
mvwinchstr(3ncurses) - get a string of characters (and attri
These routines return a NULL-terminated array of chtype quantities, starting at the current cursor position in the named window and ending at the right margin o





We can't live, work or learn in freedom unless the software we use is free.