Hello,
A bug in Sun Lucid Common Lisp (sun 3 -- No problem on Sun4).
I think it's easy to get to that situation, so other people
may have met the problem. Is there a clean solution ?
> (lisp-implementation-version)
"3.0.1"
> (report-compiler-options)
;;; Compiler options are:
;;; Target.............SUN-68881
;;; Egc........................T
;;; Show-Optimizations.......Nil
;;; Undef-Warnings.............T
;;; Warnings...................T
;;; Documentation..............T
;;; Read-Safety..............Nil
;;; Write-Safety.............Nil
;;; Bounds-Check.............Nil
;;; File-Messages..............T
;;; Messages.................Nil
;;; Fast-Entry...............Nil
;;; Tail-Merge.................T
;;; Notinline................Nil
;;; Compiler optimizations are:
;;; Speed......................3
;;; Safety.....................1
;;; Space......................0
;;; Compilation-Speed..........0
>
(defun toto (x y) (+ (the float x) y))
Toto
> (compile 'toto)
;;; Warning: The following function is not known to be defined:
Lucid::%Generic-Binary-+ was referenced by Toto
Toto
>
Same result for any add/sub between a float and a type for which
there seems to be no specific operation (t, rational...):
(defun tata (x)
(declare (rational x))
(- x 1.0))
no problem with a float and a fixnum
The solution for toto is quite ugly:
(defun toto (x)
(declare (rational x))
(+ (the float (coerce x 'float)) 1.0))
^^^^^^^^^^
necessary!