emacs-devel
[Top][All Lists]
Advanced

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

Re: Code for converting between Elisp and Calc floats


From: Stefan Monnier
Subject: Re: Code for converting between Elisp and Calc floats
Date: Tue, 27 Oct 2009 02:16:07 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

> For the C code anyhow, even if the integer component word size was not
> passed along in the interface, you would have anyhow to manage strange
> word sizes. This is because the mantissa is 53 bits, and 53 is not
> a multiple of 16. Also the mantissa is not aligned on the double word
> boundary (the sign + exponent not being a muliple of 16 bits) and you
> also have this phantom bit case to handle.

I think if you use frexp+floor, most of those issues won't matter much.

>> I think it fits better in C. Basically, it would be the equivalent to
>> C's frexp.
> C++' frexp and ldexp are not a direct alternative,

I understand.  The interface you proposed is closer to what we'd like
than what frexp has to offer.

> Another alternative would be that frexp and ldexp and suhlikes are
> made builtin functions, and that the construct-float,
> deconstruct-float functions are in Lisp using those builtins: that
> would indeed be my preference if everyone thinks that the submitted
> C code is too complex. 

Actually my preference would be to keep the functionality you proposed
(i.e. two functions (de)construct-float written in C), except force the
base to be 65536 (i.e. 16bits per integer), and rewrite the C code to
use standard functions like frexp, floor, isnan, and friends.


        Stefan




reply via email to

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