[Openmcl-devel] two portability issues
Rainer Joswig
joswig at lisp.de
Sat Dec 20 17:34:21 PST 2014
>>>
>>> ** second issue: LOOP clause MAXIMIZE**
>>> in above function there is a clause MAXIMIZE … FIXNUM .
>>> In CCL (and several other implementations, with the exception of LispWorks) this causes that a wrong result (a negative number) is computed. Without the FIXNUM declaration the result is correct.
>>
>> Does it return the same result (perhaps more slowly) if the FIXNUM declaration is retained and the OPTIMIZE declaration is changed to something like (SAFETY 3) (SPEED 0) ?
>
> The problem seems to appear without optimize declarations...
>
> (defun get-longest-path (nodes node-id visited &aux (max 0))
> (setf (svref visited node-id) t)
> (setf max (loop for neighbour of-type route in (svref nodes node-id)
> unless (svref visited (route-dest neighbour))
> maximize (+ (the fixnum (route-cost neighbour))
> (the fixnum (get-longest-path nodes
> (route-dest neighbour)
> visited)))
> fixnum))
> (setf (svref visited node-id) nil)
> max)
>
> Safety 3 and Speed 0 takes a long time and returns the wrong result: -1152921504606837995
>
> The expected result would have been 8981.
it works for real, but not fixnum… The computed numbers are not outside the fixnum range, though.
… maximize (…) real ) works
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.clozure.com/pipermail/openmcl-devel/attachments/20141221/1d4b90c7/attachment.htm>
More information about the Openmcl-devel
mailing list