chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] FILE* interface


From: Peter Keller
Subject: Re: [Chicken-users] FILE* interface
Date: Sun, 7 Jul 2002 01:48:52 -0500
User-agent: Mutt/1.2i

On Thu, Jul 04, 2002 at 09:05:53AM +0200, felix wrote:
> Brilliant! I'm looking forward to trying it out. I'm really eager to add
> full numeric tower support to Chicken. What's needed is some rather
> boring dispatching code that invokes the appropriate MP routines
> (or the builtin ones for fixnums/flonums). There is of course more to it:
> the compiler has to be patched so that it doesn't replace calls to `+', etc.
> with the usual ones, but all this can be done (somehow).

Hello,

So, I've made lots of progress in getting this ready for you. I have
about a 1/3 of the tester code done that proves that the API(about 250
functions!) conforms to reality. If things go well this weekend(and I
don't get too burned out writing the code), the first version should
be done.

I do have a question though, while I've not implemented a few API calls due
to their complicatedness, there is one of them that should be implemented.

It looks like this:

char* mpf_get_str(char *str, mp_exp_t *expptr, int base, size_t n_digits, 
        mpf_t op);

Now, the way this functions works is that you pass it a 'op' mpf_t
variable, 'n_digits' worth of the manitssa you desire, the 'base' the
number is in, and 'str' space to write the mantissa(however, if str is
NULL, then return dynamic memory containing the mantissa and this is
the only case I am interested in right now).

So, there is one parameter left: 'expptr'.

The way this parameter works is that it is a pointer to a single mp_exp_t
variable that gets filled in with the exponent of the floating point number.

What would be the best way of implementing this? I suppose I could
return a list of two things, the car being the string mantissa and the
cdr being the exponent, or I could try to do it some other way involving
allocating memory for the variable to write the exponent in and then
passing a pointer to it somehow. I am leaning toward the former of
returning a list of two values since that is more scheme-like.

Thanks for your input.

-pete

P.S. I still think you should think about how foreign typedefs can be
implemented in a generic fashion. :) As I'm looking at more things
to port to chicken, I'm noticing they are quite pervasive, and very
os/architecture dependent.





reply via email to

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