Function: log

log is a function defined in floatfns.c.

Signature

(log ARG &optional BASE)

Documentation

Return the natural logarithm of ARG.

If the optional argument BASE is given, return log ARG using that base.

Other relevant functions are documented in the number group.

View in manual

Probably introduced at or before Emacs version 24.3.

Shortdoc

;; number
(log 54.59)
    => 3.9998507157936665

Source Code

// Defined in /usr/src/emacs/src/floatfns.c
{
  double d = extract_float (arg);

  if (NILP (base))
    d = log (d);
  else
    {
      double b = extract_float (base);

      if (b == 10.0)
	d = log10 (d);
#if HAVE_LOG2
      else if (b == 2.0)
	d = log2 (d);
#endif
      else
	d = log (d) / log (b);
    }
  return make_float (d);
}