Re: floating-point-bits

"Paul Werkowski (as pw at snoopy dot qozzy dot com)" <[email protected]>
Newsgroups gmane.lisp.lispworks.general
Message-ID <[email protected]>
Dang, yet another.

(defun make-double-float (bits)
   (declare (type (unsigned-byte 64) bits))  ; <<< not 32
   (let* ((sgn  (ldb (byte  1 63) bits))
          (exp  (ldb (byte 11 52) bits))
          (mant (ldb (byte 52 0) bits))
          (signif (logior mant (ash 1 52)))
          (sign (if (= sgn 1) -1d0 1d0))
          (expon(- exp 1023 51)))
     (float-sign sign (scale-float (float signif 1d0) expon)))) ;<<< add 1d0

_______________________________________________
Lisp Hug - the mailing list for LispWorks users
[email protected]
http://www.lispworks.com/support/lisp-hug.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.