Hello,
Sorry for coming so late into this thread. Thanks Jay for introducing my contribution, and thanks to you all for the feedback.
I fully agree with most of the comments:
* code presentation (indentation, commenting) probably needs some improvement (actually it took some time before I got something working well, and now I realize that I've neglected this aspect)
* For your information "voir" just mean "see" in French, sorry for I forgot this in the code. Richard: if ever you get in touch with the French bureaucracy and have to fill in some form, then please remember that to fill an item by "void", just write "néant",
* I developped and tested the code for the 64bit little endian float implementation of emacs (on a Mingw Windows2000 platform). I have put some code so that porting to other type of platform is easier, however I cannot guarantee that it would work at all for those ports. I did not know that emacs had 64bits floats only in all platform (and it seems to me quite unwise to base some code on the assumption that it will always & everywhere be that way).
Now coming back to the contribution itself: of course we could discuss at length whether or not I did it the right way. However, we should first agree that there some need for having conversion function between Lisp floats and calc floats. Lisp float are the usual IEEE753 64bits radix 2 floats, while Calc floats are list based radix-10, configurable precision.
The need which I see is that I often use calc as a math library. Native lisp has a few math primitives, however, when it comes to matrices, polynomials, and suchlikes, only Calc can make it. Most calc users use calc only as a Desk calculator, not as a math library. Most often I use it as a library for some preprocessor code that I include inline within some LaTeX document to generate some calculated texted values (I intend to make this preprocessor code public some day when it is mature enough, but I can provide draft code to anyone interested in it).
When you use Calc as a library, then you would like it to interact more easily with some other piece of code, or simply to write the code more simply when the precision you need is only that of a 64bit float: nobody will deny that it is simpler to write:
0.5
instead of
'(float 5 -1)
However, currently calc do not accept numbers like 0.5 (those would be processed as if they were integers, and this causes at best an error throw, and at worst a buggy code).
So if we come to the conclusion that indeed there is a need for Calc-to-Lisp + Lisp-to-Calc float conversion, then we can go into the next step of the discussion that is to discuss what is the best way to do it.
Regards,
Vincent.
Achetez un nouveau PC et bénéficiez de Windows 7 dès sa sortie ! En savoir plus