From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?iso-8859-1?B?VmluY2VudCBCZWxh72NoZQ==?= Newsgroups: gmane.emacs.devel Subject: RE: Code for converting between Elisp and Calc floats Date: Sun, 25 Oct 2009 12:36:38 +0100 Message-ID: References: <200910082047.n98KlkAB020482@godzilla.ics.uci.edu> NNTP-Posting-Host: lo.gmane.org Content-Type: multipart/alternative; boundary="_eece57b7-89b5-4a09-a2c2-38172433207f_" X-Trace: ger.gmane.org 1256470725 4354 80.91.229.12 (25 Oct 2009 11:38:45 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 25 Oct 2009 11:38:45 +0000 (UTC) To: emacs-devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Oct 25 12:38:34 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1N21P1-00020m-4C for ged-emacs-devel@m.gmane.org; Sun, 25 Oct 2009 12:36:51 +0100 Original-Received: from localhost ([127.0.0.1]:41505 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N21P0-0003v4-F3 for ged-emacs-devel@m.gmane.org; Sun, 25 Oct 2009 07:36:50 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N21Ov-0003uu-VW for emacs-devel@gnu.org; Sun, 25 Oct 2009 07:36:46 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N21Oq-0003tq-FN for emacs-devel@gnu.org; Sun, 25 Oct 2009 07:36:44 -0400 Original-Received: from [199.232.76.173] (port=57812 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N21Oq-0003ti-6Y for emacs-devel@gnu.org; Sun, 25 Oct 2009 07:36:40 -0400 Original-Received: from blu0-omc4-s22.blu0.hotmail.com ([65.55.111.161]:63241) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1N21Op-0002rs-Mr for emacs-devel@gnu.org; Sun, 25 Oct 2009 07:36:39 -0400 Original-Received: from BLU104-W13 ([65.55.111.136]) by blu0-omc4-s22.blu0.hotmail.com with Microsoft SMTPSVC(6.0.3790.3959); Sun, 25 Oct 2009 04:36:39 -0700 X-Originating-IP: [92.135.119.98] Importance: Normal In-Reply-To: <87hbto11d8.fsf@lola.goethe.zz> X-OriginalArrivalTime: 25 Oct 2009 11:36:39.0236 (UTC) FILETIME=[6AA04040:01CA5567] X-detected-operating-system: by monty-python.gnu.org: Windows 2000 SP4, XP SP1+ X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:116391 Archived-At: <87aazj2r7d.fsf_-_@vh213601.truman.edu> <87ws2kmuez.fsf@gmail.com> <87hbto11d8.fsf@lola.goethe.zz> MIME-Version: 1.0 --_eece57b7-89b5-4a09-a2c2-38172433207f_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hello=2C Sorry for coming so late into this thread. Thanks Jay for introducing my co= ntribution=2C and thanks to you all for the feedback.=20 I fully agree with most of the comments:=20 * code presentation (indentation=2C commenting) probably needs some improve= ment (actually it took some time before I got something working well=2C and= now I realize that I've neglected this aspect) * For your information "voir" just mean "see" in French=2C sorry for I forg= ot this in the code. Richard: if ever you get in touch with the French bure= aucracy and have to fill in some form=2C then please remember that to fill = an item by "void"=2C just write "n=E9ant"=2C * I developped and tested the code for the 64bit little endian float implem= entation of emacs (on a Mingw Windows2000 platform). I have put some code s= o that porting to other type of platform is easier=2C however I cannot guar= antee 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 w= ay). Now coming back to the contribution itself: of course we could discuss at l= ength whether or not I did it the right way. However=2C we should first agr= ee that there some need for having conversion function between Lisp floats = and calc floats. Lisp float are the usual IEEE753 64bits radix 2 floats=2C = while Calc floats are list based radix-10=2C configurable precision. The need which I see is that I often use calc as a math library. Native lis= p has a few math primitives=2C however=2C when it comes to matrices=2C poly= nomials=2C and suchlikes=2C only Calc can make it. Most calc users use calc= only as a Desk calculator=2C not as a math library. Most often I use it as= a library for some preprocessor code that I include inline within some LaT= eX document to generate some calculated texted values (I intend to make thi= s preprocessor code public some day when it is mature enough=2C but I can p= rovide draft code to anyone interested in it).=20 When you use Calc as a library=2C then you would like it to interact more e= asily with some other piece of code=2C or simply to write the code more sim= ply when the precision you need is only that of a 64bit float: nobody will = deny that it is simpler to write:=20 0.5=20 instead of=20 '(float 5 -1) However=2C currently calc do not accept numbers like 0.5 (those would be pr= ocessed as if they were integers=2C and this causes at best an error throw= =2C and at worst a buggy code). So if we come to the conclusion that indeed there is a need for Calc-to-Lis= p + Lisp-to-Calc float conversion=2C then we can go into the next step of t= he discussion that is to discuss what is the best way to do it. Regards=2C Vincent. =20 _________________________________________________________________ Nouveau ! Tout Windows d=E9barque dans votre t=E9l=E9phone. Voir les Window= s phone http://clk.atdmt.com/FRM/go/175819071/direct/01/= --_eece57b7-89b5-4a09-a2c2-38172433207f_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hello=2C


Sorry for coming so late into this thread. Thanks Jay f= or introducing my contribution=2C and thanks to you all for the feedback. <= BR>
I fully agree with most of the comments:

* code presentation= (indentation=2C commenting) probably needs some improvement (actually it t= ook some time before I got something working well=2C and now I realize that= I've neglected this aspect)
* For your information "voir" just mean "se= e" in French=2C sorry for I forgot this in the code. Richard: if ever you g= et in touch with the French bureaucracy and have to fill in some form=2C th= en please remember that to fill an item by "void"=2C just write "n=E9ant"= =2C
* 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=2C however I cann= ot 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 unw= ise to base some code on the assumption that it will always &=3B everywh= ere be that way).

Now coming back to the contribution itself: of cou= rse we could discuss at length whether or not I did it the right way. Howev= er=2C we should first agree that there some need for having conversion func= tion between Lisp floats and calc floats. Lisp float are the usual IEEE753 = 64bits radix 2 floats=2C while Calc floats are list based radix-10=2C confi= gurable precision.

The need which I see is that I often use calc as = a math library. Native lisp has a few math primitives=2C however=2C when it= comes to matrices=2C polynomials=2C and suchlikes=2C only Calc can make it= . Most calc users use calc only as a Desk calculator=2C not as a math libra= ry. Most often I use it as a library for some preprocessor code that I incl= ude inline within some LaTeX document to generate some calculated texted va= lues (I intend to make this preprocessor code public some day when it is ma= ture enough=2C but I can provide draft code to anyone interested in it).
When you use Calc as a library=2C then you would like it to interact = more easily with some other piece of code=2C or simply to write the code mo= re simply when the precision you need is only that of a 64bit float: nobody= will deny that it is simpler to write:=A0

0.5=A0

instead of= =A0

'(float 5 -1)


However=2C currently calc do not accept= numbers like 0.5 (those would be processed as if they were integers=2C and= this =A0causes at best an error throw=2C and at worst a buggy code).
So if we come to the conclusion that indeed there is a need for Calc-to-L= isp + Lisp-to-Calc float conversion=2C then we can go into the next step of= the discussion that is to discuss what is the best way to do it.

Re= gards=2C

=A0 =A0 Vincent.


Achetez un nouv= eau PC et b=E9n=E9ficiez de Windows 7 d=E8s sa sortie ! En savoir plus = --_eece57b7-89b5-4a09-a2c2-38172433207f_--