[Ecls-list] Fwd: Re: Re: latest cvs update fails on cygwin

Larry Clapp larry at theclapp.org
Sun Oct 22 18:56:33 UTC 2006


On Sun, Oct 22, 2006 at 07:39:02PM +0200, Juan Jose Garcia-Ripoll wrote:
> 2006/10/22, Larry Clapp <larry at theclapp.org>:
> > > SI> (round 0.3)
> > > #<a DIVISION-BY-ZERO>
> > > Top level.
> > > SI>> (round 0.3d0)
> > > #<a DIVISION-BY-ZERO>
> > > Top level.
> > > SI>>>
> >
> > In ecl_min, CL:ROUND fails on any floating point number -- but
> > only under Cygwin.  Under Linux and Win32 native it works just
> > fine.
> 
> I know this is asking too much, but would it be possible for you to
> debug ecl_min.exe? You just need to launch the program from inside
> GDB, write (ROUND 0.3d0) and provide me with the backtrace of what
> happened. The code that is invoked, round_double() in num_co.d is
> pretty innocent: it uses only floor() and performs no division by
> values which could be potentially zero!

Backtrace was:

> (gdb) run
> ;*** Lisp core booted ****
> ECL (Embeddable Common Lisp)  65536 pages
> 
> > (round 0.3d0)
> 
> Breakpoint 2, 0x00418069 in cl_error ()
> (gdb) bt
> #0  0x00418069 in cl_error ()
> #1  0x0043cdd7 in make_doublefloat ()
> #2  0x0043ada8 in round1 ()
> #3  0x00000000 in ?? ()

I added a printf in round1():

        case t_doublefloat: {
                double d = df(x);
                double q = round_double(d);
                printf( "d is %lf, q is %lf\n", d, q );
                VALUES(0) = double_to_integer(q);
                VALUES(1) = make_doublefloat(d - q);
                break;
        }

and tried ecl_min standalone:

> ./ecl_min
> ;*** Lisp core booted ****
> ECL (Embeddable Common Lisp)  65536 pages
> 
> > (round 0.3d0)
> d is 0.300000, q is nan
> 
> Unrecoverable error:
> Lisp initialization error.

and I think the problem is here:

num_co.d:

  static double
  round_double(double d)
  {
	  if (d > 0) {
		  double q = floor(q + 0.5);
		                   ^

(I've no idea why this even compiles, but it's been a long time since
I did a lot of C.)

I changed it to

                  double q = floor(d + 0.5);
		                   ^

and re-ran make and now

> ;;; Emitting code for ASIN.
> d is 0.301030, q is 0.000000

and so life is good (I think; make is still running as I type).

-- Larry





More information about the ecl-devel mailing list