Fwd: [Openmcl-devel] Help on using FPC-compiler

Gary Byers gb at clozure.com
Thu Dec 9 00:07:17 UTC 2004

On Wed, 8 Dec 2004, Randall Beer wrote:

> Begin forwarded message:
> > From: Randall Beer <beer at eecs.cwru.edu>
> > Date: December 8, 2004 12:24:46 PM EST
> > To: Diedrich Wolter <dwolter at informatik.uni-bremen.de>
> > Subject: Re: [Openmcl-devel] Help on using FPC-compiler
> >
> > A clue that something has gone badly wrong is that after the call to
> > LIN-SOLVE-FPC, 0.0D0 evaluates to -5.370073764483212D0!
> >
> > A fix for the problem is to redefine WITH-TEMP-DOUBLE-FLOATS as below.
> > Before I release a new version, could people who are using FPC-PPC try
> > this fix and make sure that nothing else is broken by it?
> >
> > For those who care, the problem was that the default value of
> > temporary variables in WITH-TEMP-DOUBLE-FLOATS is 0.0D0.  Since these
> > temporary variables are declared to be DOUBLE-FLOATs with
> > DYNAMIC-EXTENT, I was assuming that I was getting fresh storage on the
> > stack for each double, when in fact I was getting fresh storage on the
> > stack for each pointer to the SAME double (0.0d0, which OpenMCL seems
> > to store uniquely unless it is explicitly copied).  Thus, any
> > SET-DOUBLE! done on any of these temps was actually modifying the
> > value of 0.0D0.
> >
> > The fix below is less than ideal, since it involves making a copy of
> > every initial value of every temporary float each time
> >
> > Gary: Is there a better way to do this, e.g. by using STACK-BLOCK?
> >
> > Randy
> >

There's a macro - CCL::WITH-STACK-DOUBLE-FLOATS - that does something
very similar to what WITH-TEMP-DOUBLE-FLOATS does.  It'll coerce other
types of numbers in initforms into DOUBLE-FLOATs and is careful to
always do a copy.

In OpenMCL, this macro is defined in "ccl:lib;number-macros.lisp";
it's necessary to

? (require "NUMBER-MACROS")

to load it.  (It -may- be built into the image in MCL.)

If there are significant differences between what
CCL::WITH-STACK-DOUBLE-FLOATS does and what you want, let me know.

More information about the Openmcl-devel mailing list