chicken-hackers
[Top][All Lists]
Advanced

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

Re: [Chicken-hackers] [PATCH] Fix a few more mistakes in types.db


From: Felix
Subject: Re: [Chicken-hackers] [PATCH] Fix a few more mistakes in types.db
Date: Mon, 12 Mar 2012 15:31:57 +0100 (CET)

From: Peter Bex <address@hidden>
Subject: [Chicken-hackers] [PATCH] Fix a few more mistakes in types.db
Date: Sun, 11 Mar 2012 21:05:28 +0100

> Hi there,
> 
> I found a bug in the specialization for the ROUND procedure; the
> specialization calls C_a_i_flonum_round while it should call
> C_a_i_flonum_round_proper.  This results in a difference when the
> following program is interpreted versus when it is compiled with
> various levels of optimization:
> 
> (print (round 4.5)) ;; 5.0 when compiled with -O3 or higher, 4.0 otherwise
> 
> The correct answer is 4.0 since R5RS says round needs to round to the
> nearest even number when the number is halfway between two integers.
> 
> I added a test for this to library-tests.scm, but figured out that
> it wasn't compiled at all, which is why this bug wasn't caught by
> "make check".  Since the library is large and has many specializations,
> it makes sense to compile the library test.  As we add more tests, these
> will automatically test any additional specializations.
> 
> After making it compile, I found several more mistakes which I've also
> fixed in this patch.

Thanks. Signed off and pushed.

> 
> By the way, I don't understand why the continuation test at the end
> used to work; when compiled it complains the second time it calls
> (k #f) that k is false, which I'd expect.  Can someone explain why
> this isn't the case in interpreted mode?

In compiled mode, the list of toplevel expressions is treated like
being inside a big "(begin ...)" form. In interpreted mode this is not
the case: each toplevel form represents an expression entered at the
REPL and the continuation does not include the previously evaluated
expressions. Don't ask for details though, or the attempt to mentally
follow the twisted paths of continuations for each case will just
make both our heads hurt and not make anyone wiser.


cheers,
felix



reply via email to

[Prev in Thread] Current Thread [Next in Thread]