On Sep 2, 2009, at 12:04 AM, Raymond Toy wrote:
> ?iga Lenar?i? wrote:
>>
>> On Sep 1, 2009, at 11:05 PM, Raymond Toy wrote:
>>>
>>> Hopefully the compiler is smart enough to know that flonum is the
>>> same
>>> as double-float.
>>>
>>> Ray
>>>
>>
>> This is the real question. Moreover - do (more or less) all lisps do
>> this? I'll do a test on SBCL.
>>
> I'm almost 100% sure sbcl is fine, because I'm 100% sure that cmucl
> handles this.
>
> Ray
>
I did a test in this way (using my fft.lisp..):
:lisp (setf *print-array* nil);
:lisp (setf *N* (* 1024 64));
:lisp (setf *ra* (make-array *N* :element-type 'double-float)
*ia* (make-array *N* :element-type 'double-float));
:lisp (dotimes (i *N*) (setf (aref *ra* i) (random 1.0)
(aref *ia* i) (random 1.0)));
:lisp (time (forward-fft *ra* *ia*));
and compare it to a version where I substitute all 'double-float's
with 'flonum's in fft.lisp. I get the same resoults. Note that time
spent doing actual fft is 0.035 on my machine, while a maxima's fft()
call for a list of length (* 1024 64) takes 4 seconds. The only
problem is efficient data conversion.
So it's a go for 'flonum' type usage in fast numerical code I guess..
Regards,
Ziga