Nyquist / XLISP 2.0 - Contents | Tutorials | Examples | Reference

# cl:log

The cl:log function does the same as the Nyquist/XLISP log function, but also accepts integer numbers and has an optional 'base' argument:

(cl:log number [base])
  number - an integer or floating-point number
  base - an integer or floating-point number
  returns - the the logarithm of number in base base

    (defun cl:log (number &optional base)
      (if base
          (if (zerop base)
              0.0
              (/ (log (float number)) (log (float base))))
          (log (float number))))

The 'cl:log' function returns the logarithm of 'number' in base 'base'. If 'base' is not supplied its value is 'e', the base of the natural logarithms. If the 'base' argument is zero, then 'cl:log' returns zero. The result is always a floating-point number.

Back to top

Nyquist / XLISP 2.0 - Contents | Tutorials | Examples | Reference