Classification of Formats
Function:
(defun formatp (f) (declare (xargs :guard t)) (and (consp f) (consp (cdr f)) (consp (cddr f)) (natp (cadr f)) (> (cadr f) 1) (natp (caddr f)) (> (caddr f) 1)))
Function:
(defun explicitp (f) (declare (xargs :guard (formatp f))) (car f))
Function:
(defun prec (f) (declare (xargs :guard (formatp f))) (cadr f))
Function:
(defun expw (f) (declare (xargs :guard (formatp f))) (caddr f))
Function:
(defun sigw (f) (declare (xargs :guard (formatp f))) (if (explicitp f) (prec f) (1- (prec f))))
Function:
(defun encodingp (x f) (declare (xargs :guard t)) (and (formatp f) (bvecp x (+ 1 (expw f) (sigw f)))))
Function:
(defun hp nil (declare (xargs :guard t)) '(nil 11 5))
Function:
(defun sp nil (declare (xargs :guard t)) '(nil 24 8))
Function:
(defun dp nil (declare (xargs :guard t)) '(nil 53 11))
Function:
(defun bf nil (declare (xargs :guard t)) '(nil 8 8))
Function:
(defun ep nil (declare (xargs :guard t)) '(t 64 15))
Theorem:
(defthm formatp-sp (formatp (sp)))
Theorem:
(defthm formatp-dp (formatp (dp)))
Theorem:
(defthm formatp-hp (formatp (hp)))
Theorem:
(defthm formatp-ep (formatp (ep)))
Function:
(defun sgnf (x f) (declare (xargs :guard (encodingp x f))) (bitn x (+ (expw f) (sigw f))))
Function:
(defun expf (x f) (declare (xargs :guard (encodingp x f))) (bits x (1- (+ (expw f) (sigw f))) (sigw f)))
Function:
(defun sigf (x f) (declare (xargs :guard (encodingp x f))) (bits x (1- (sigw f)) 0))
Function:
(defun manf (x f) (declare (xargs :guard (encodingp x f))) (bits x (- (prec f) 2) 0))
Function:
(defun bias (f) (declare (xargs :guard (formatp f))) (- (expt 2 (- (expw f) 1)) 1))