Efficient Lisp functions -- using results of symbolic calculations numerically
Subject: Efficient Lisp functions -- using results of symbolic calculations numerically
From: Raymond Toy (RT/EUS)
Date: Fri, 07 Sep 2007 14:31:34 -0400
Robert Dodier wrote:
> On 9/7/07, Raymond Toy (RT/EUS) <raymond.toy at ericsson.com> wrote:
>
>>> #<FUNCTION $H ($X) (DECLARE (IN-DEFUN $H) (SPECIAL $X) (FLONUM $X))
>>> (BLOCK $H
>>> (PROGN NIL (+ (* 2.0 (COS (EXPT$ $X 2))) (- (* (EXPT$ $X -2) (SIN
>>> (EXPT$ $X 2)))))))>
>
>> It would probably help a bit more if Lisp actually knew what a flonum
>> type was. :-) When I compile this with cmucl, it complains that flonum
>> is an unknown type. We probably need to add (deftype flonum ()
>> 'double-float) somewhere.
>
> Heh. Who knows, we could even change the translator to
> emit (DECLARE (DOUBLE-FLOAT ...)) or whatever ...
Thought about that, but I decided to add the deftype and emit (declare
(type double-float ...)).
Changes committed, and no warnings from cmucl when this example is compiled.
Is there a way to tell the translator to insert some optimization
settings? Just curious.
Ray