Commit efbf11a6f5cd7e15f51cdb52fefd1584ab58c3d9

Authored by Raymond Toy
1 parent bc851c79

Fix bug in FLOAT: second arg is optional! Add FLOAT-NAN-P method.

qd-methods.lisp:
* Second arg to {{{FLOAT}}} is optional.
* Add {{{FLOAT-NAN-P}}}.

qd-package.lisp:
* Need to shadow {{{EXT:FLOAT-NAN-P}}} on cmucl.
qd-methods.lisp
... ... @@ -288,8 +288,8 @@
288 288 x)
289 289  
290 290 (declaim (inline float))
291   -(defun float (x num-type)
292   - (qfloat x num-type))
  291 +(defun float (x &optional num-type)
  292 + (qfloat x (or num-type 0.0)))
293 293  
294 294 (defmethod qrealpart ((x number))
295 295 (cl:realpart x))
... ... @@ -1111,6 +1111,13 @@ the same precision as the argument. The argument can be complex."))
1111 1111 (defmethod float-pi ((z qd-complex))
1112 1112 +pi+)
1113 1113  
  1114 +(defmethod float-nan-p ((x cl:float))
  1115 + ;; CMUCL has ext:float-nan-p. Should we use that instead?
  1116 + (not (= x x)))
  1117 +
  1118 +(defmethod float-nan-p ((x qd-real))
  1119 + (float-nan-p (qd-parts (qd-value x))))
  1120 +
1114 1121  
1115 1122 (define-condition domain-error (simple-error)
1116 1123 ((function-name :accessor condition-function-name
... ...
qd-package.lisp
... ... @@ -211,6 +211,8 @@
211 211 #:rational
212 212 #:rationalize
213 213 )
  214 + #+cmu
  215 + (:shadow ext:float-nan-p)
214 216 ;; Export types
215 217 (:export #:qd-real
216 218 #:qd-complex)
... ...