chicken-hackers
[Top][All Lists]
Advanced

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

Re: [Chicken-hackers] [PATCH] Re: make check failing


From: Peter Bex
Subject: Re: [Chicken-hackers] [PATCH] Re: make check failing
Date: Tue, 1 Jan 2013 21:58:25 +0100
User-agent: Mutt/1.4.2.3i

On Fri, Dec 28, 2012 at 03:27:36PM +0100, Felix wrote:
> >> Attached is a patch that corrects the behaviour of
> >> C_i_foreign_[unsigned]_integer64_argumentp (there where bugs in both
> >> the signed and unsigned variant).
> > 
> > Thanks!  A question though: Shouldn't C_i_foreign_integer64_argumentp
> > also check that the flonum is an integer (ie, there's nothing after the
> > decimal point)?
> 
> It could. Should it? C just truncates. I dunno.

I think it should.  This will be an extra help in detecting bugs; if a
user accidentally passes a flonum where a fixnum is expected that's
always a bug, unless the flonum is the result of a fixnum overflow.  And
in the latter case, this should always be an integer value.  To catch
accidental misuse the additional check is useful.

I've attached a modified version of your patch, which I signed off.

> > I think we should seriously consider supporting bignums in core.  
> 
> Argh.

I know :)

> > They won't add much extra overhead in terms of optimizations
> 
> I think quite the opposite is the case, but I'm usually wrong with my
> performance estimations. The only option is probably to try it out,
> which is a lot of hard work.

Yep.

> > [the added exactness precision] at least
> > allows for some (admittedly trivial) optimizations you don't get when
> > using flonums, like knowing that integer? and exact? return true.
> 
> I don't think that it adds many optimization options.

I agree.

> > Besides, you won't lose information which helps srfi-4 64 bit types make
> > sense, and simplifies the part of the FFI currently under consideration.
> 
> That is one case. It also _could_ simplify a lot of FFI code and handling
> of word-sized integers in general. 

I hope so.

> I get cramps thinking of all the work that would have to go into such
> a project.

Yeah, me too.  But it's good to hear you aren't against it per se.
I might give this a try sometime.  There are some improvements I want
to make in the numbers egg first, which then should make integration
into core simpler.  I know the numbers egg improvements have been slow
going, but it's a fine goal for the new year ;)

Cheers,
Peter
-- 
http://sjamaan.ath.cx

Attachment: 0001-Corrected-behaviour-for-C_i_foreign_-unsigned-_integ.patch
Description: Text document


reply via email to

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