Macro: WITH-PRECISION

Documentation

Evalute BODY with *precision* bound to PREC.

Source

(defmacro with-precision (prec &body body)
  "Evalute BODY with *precision* bound to PREC."
  (let ((precision (gensym)))
    `(let ((,precision ,prec))
       (assert (integerp ,precision)
	       (,precision)
	       "Precision must be an integer, not ~S" ,precision)
       (let ((*precision* (10^ ,precision)))
	 (declare (special *precision*))
	 ,@body))))
Source Context