[Openmcl-devel] Floating point exceptions on Windows

Martin martin.lisp at gmail.com
Sun May 3 08:18:55 PDT 2009


Hi!

I am using CCL 1.3-r11949 on Windows XP SP2 and have a problem with 
floating point exception propagation.

Now, I have a file app1.c with a function with the following code extract:


__declspec(dllexport) double fn1 ()
{
   double zero = 0;
   return 1.0/zero;
}

I compiled it into a DLL (Using MS Visual C++ 2005 Express Edition) with 
the following command:

cl /LD app1.c

to yield app1.dll.

Using it in CCL:

Welcome to Clozure Common Lisp Version 1.3-r11949M  (WindowsX8632)!
? (open-shared-library "D:/studies/floats/app1/app1.dll")
#<SHLIB app1.dll #x89DED5E>
? (ff-call (%reference-external-entry-point (external "fn1")) :double-float)
1.0000000000000002D0
? (log 10)
 > Error: DIVISION-BY-ZERO detected
 >        performing LOG on (10.0)
 > While executing: CCL::%FP-ERROR-FROM-STATUS, in process listener(1).
 > Type :POP to abort, :R for a list of available restarts.
 > Type :? for other options.
1 >

Two questions:
  1. Is there a way that to can get the error signaled on the offending 
statement rather than being propagated to the next?
  2. How can I disable floating point exceptions from within CCL?

(To put the problem in context, let me mention that I encountered a 
problem along these lines while trying to create a wrapper for the 
RealLib library.)

Regards,
Martin.




More information about the Openmcl-devel mailing list