Function: math-midi-round

math-midi-round is a byte-compiled function defined in calc-units.el.gz.

Signature

(math-midi-round NUM)

Documentation

Round NUM to an integer N if NUM is within calc-note-threshold cents of N.

Source Code

;; Defined in /usr/src/emacs/lisp/calc/calc-units.el.gz
(defun math-midi-round (num)
  "Round NUM to an integer N if NUM is within calc-note-threshold cents of N."
  (let* ((n (math-round num))
         (diff (math-abs
                (math-sub num n))))
    (if (< (math-compare diff
                         (math-div (math-read-expr calc-note-threshold) 100)) 0)
        n
      num)))