>>>>> "Robert" == Robert Dodier <robert.dodier at gmail.com> writes:
[snip]
Robert> (defun significand-bits (x) (nth-value 0 (integer-decode-float x)))
Robert> (defun exponent-bits (x) (nth-value 1 (integer-decode-float x)))
Robert> (defun float-special-value-p (x)
Robert> (and (floatp x)
Robert> (let
Robert> ((max-exponent
Robert> (typecase x
Robert> (short-float (exponent-bits most-positive-short-float))
Robert> (single-float (exponent-bits most-positive-single-float))
Robert> (double-float (exponent-bits most-positive-double-float))
Robert> (long-float (exponent-bits most-positive-long-float)))))
Robert> (= (exponent-bits x) (1+ max-exponent)))))
Note that CMUCL (and SBCL) won't let you integer-decode-float infinity
or NaN. CMUCL provides ext:float-infinity-p and ext:float-nan-p to
detect these special values. But if it's IEEE, the values are known a
priori. Plus you have to turn off floating point exceptions in CMUCL,
because I think they're enabled by default.
Ray