Function: math-logunits-level

math-logunits-level is a byte-compiled function defined in calc-units.el.gz.

Signature

(math-logunits-level VAL REF DB POWER)

Documentation

Compute the value of VAL in decibels or nepers.

Source Code

;; Defined in /usr/src/emacs/lisp/calc/calc-units.el.gz
(defun math-logunits-level (val ref db power)
  "Compute the value of VAL in decibels or nepers."
      (let* ((ratio (math-simplify-units (math-div val ref)))
             (ratiou (math-simplify-units (math-remove-units ratio)))
             (units (math-simplify (math-extract-units ratio))))
        (math-mul
         (if db
             (math-mul
              (math-mul (if power 10 20)
                        (math-conditional-apply 'calcFunc-log10 ratiou))
              '(var dB var-dB))
           (math-mul
            (math-div (math-conditional-apply 'calcFunc-ln ratiou) (if power 2 1))
            '(var Np var-Np)))
         units)))