Infinities and NaNs
Function:
(defun infp (x f) (declare (xargs :guard (encodingp x f))) (and (mbt (encodingp x f)) (= (expf x f) (1- (expt 2 (expw f)))) (not (unsupp x f)) (= (manf x f) 0)))
Function:
(defun iencode (sgn f) (declare (xargs :guard (and (bvecp sgn 1) (formatp f)))) (if (explicitp f) (cat sgn 1 (1- (expt 2 (expw f))) (expw f) 1 1 0 (1- (sigw f))) (cat sgn 1 (1- (expt 2 (expw f))) (expw f) 0 (sigw f))))
Function:
(defun nanp (x f) (declare (xargs :guard (encodingp x f))) (and (mbt (encodingp x f)) (= (expf x f) (1- (expt 2 (expw f)))) (not (unsupp x f)) (not (= (manf x f) 0))))
Function:
(defun qnanp (x f) (declare (xargs :guard (encodingp x f))) (and (nanp x f) (= (bitn x (- (prec f) 2)) 1)))
Function:
(defun snanp (x f) (declare (xargs :guard (encodingp x f))) (and (nanp x f) (= (bitn x (- (prec f) 2)) 0)))
Function:
(defun qnanize (x f) (declare (xargs :guard (encodingp x f))) (logior x (expt 2 (- (prec f) 2))))
Function:
(defun indef (f) (declare (xargs :guard (formatp f))) (if (explicitp f) (cat (1- (expt 2 (+ (expw f) 2))) (+ (expw f) 2) 0 (- (sigw f) 2)) (cat (1- (expt 2 (+ (expw f) 1))) (+ (expw f) 1) 0 (1- (sigw f)))))