[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Number crunching in CLISP.

> If my memory serves me correctly, Bruno once told
> me that CLISP does all floating point operations by itself (i.e. -
> doesn't use the FPU).  Is this correct?

Yes, on most machines.

> If it does do floating point in software, how hard is it to
> change this?

Not very hard: add "#define FAST_DOUBLE" and "#define FAST_FLOAT" to
lispbibl.d, -fallow-single-precision to the CFLAGS in the makefile
(need gcc-2.6.0 for this), and recompile.

> Are floating point numbers stored in system format (as a C float)?

Yes, if the floating point operations are done in hardware, the
system format (i.e. IEEE) is used.

> Is the numerical code well isolated?

Yes, it is a single file called lisparit0.d.

But that won't help you much because while the floating point operations
are done in hardware, the boxing (allocating storage for the float)
and the function call and type dispatching overheads remain.

For these kinds of computations, try GCL. You will probably have to add
many disgusting (DECLARE (DOUBLE-FLOAT ...)) declarations to your program.
(Linux binaries are in ma2s2.mathematik.uni-karlsruhe.de:/pub/lisp/gcl/.)

Btw, your comparison isn't fair since the variable i is a local variable
in the C and a global (i.e. more expensive) variable in the Lisp version
of your benchmark.

                    Bruno Haible