From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: "Siraphob (Ben) Phipathananunth" Newsgroups: gmane.emacs.devel Subject: Re: Using the GNU GMP Library for Bignums in Emacs Date: Sat, 21 Apr 2018 22:40:05 +0700 Message-ID: <51e619e0-ee38-eb97-6c1d-0925b675290a@disroot.org> References: <29f933ac-a6bf-8742-66a7-0a9d6d3e5a88@disroot.org> <83bmecy6fx.fsf@gnu.org> <0d3175d8-d996-651e-b221-71978bde3a65@cs.ucla.edu> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1524325168 11827 195.159.176.226 (21 Apr 2018 15:39:28 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 21 Apr 2018 15:39:28 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 Cc: emacs-devel@gnu.org To: Paul Eggert , Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Apr 21 17:39:24 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f9ubj-0002z6-P3 for ged-emacs-devel@m.gmane.org; Sat, 21 Apr 2018 17:39:24 +0200 Original-Received: from localhost ([::1]:53214 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f9udq-0006pt-Jn for ged-emacs-devel@m.gmane.org; Sat, 21 Apr 2018 11:41:34 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36029) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f9ucc-00069f-Fz for emacs-devel@gnu.org; Sat, 21 Apr 2018 11:40:19 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f9ucb-0001FH-Pg for emacs-devel@gnu.org; Sat, 21 Apr 2018 11:40:18 -0400 Original-Received: from knopi.disroot.org ([178.21.23.139]:54958) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f9ucX-0001BC-HP; Sat, 21 Apr 2018 11:40:13 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id D7B8A2DDA9; Sat, 21 Apr 2018 17:40:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1524325211; bh=uoKumJEfHDs/YYDucSC0qVMwTBldCWkJduFoMdOjYCg=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=EHdglcDlZZVB4jdz+lSMYQ4be2sgLjWJOCw1HRm1BWK63Lv0djOiU9cc6yc7NBGUX tsRzwy0NfdE0s1rWzuV5xa6K+BE4oBMDmvdZG4MgRoHijdilJGgg/LYzWJj8vGqqdZ izWCuOPZsA/s3XaA6tqt3hQi/N5k5J7LcrwFaxDtRjuApIxBQPWKDvzFDwdOXv8Px9 c2O/BXod726c2idYRCjbVw5K2Laol4ELTdJws7IdBkHkpMYPiApfdcpaVWV7veFjDe PnVVMDnVazATCbBHrKIMk24BK51fqMwuS/nF9v/RKw/F6+NO0LEXC1etgHNQ0LUzCj 0yc+8WJPi163A== X-Virus-Scanned: Debian amavisd-new at disroot.org Original-Received: from knopi.disroot.org ([127.0.0.1]) by localhost (mail01.disroot.lan [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dWMeIYODLXpY; Sat, 21 Apr 2018 17:40:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1524325210; bh=uoKumJEfHDs/YYDucSC0qVMwTBldCWkJduFoMdOjYCg=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=SmpUNjdYTIzGT0+WBeIYpPen8xQUtkKI8NTd9Aack3QmLx8KW0SnqlKBNONvd1AJk m/KgSwpknIQXUen5RpnnzmtF2nN4RG3v5oOjfhjSfTnH8EkP0/Fq3pYUjRxZW70QGZ iZIIitv/+GLvma6YFqmTu9/4XFjU4UyCzL9J7CAP23oCX9mOxgOjNYOQ2Nr75/VPRP 1LvZdq/QDBIV0SRO6+fK4+DSOqmZlMMO+HvMhnXV7FMknj6AZ80Q3nd/HXSsAoBmS+ rHj72rMf5/V8YBgObyYTZLEiD2dCCbNy9zfKb4cAdNCaMfrzrpbqUXAcWx8Ug0rh/J WnwJPL0SqxU9A== In-Reply-To: <0d3175d8-d996-651e-b221-71978bde3a65@cs.ucla.edu> Content-Language: en-US X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 178.21.23.139 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:224765 Archived-At: Paul Eggert wrote: > Surely we should just add bignum support to existing functions +, -, > etc. Wouldn't that suffice for 'calc'? If not, why not? (Of course > 'calc' would need to be changed to exploit the bignums properly, no > matter how we add bignums.) Of course we could to do that. Hopefully there isn't existing Emacs Lisp code that relies on unsafe arithmetic /anywhere/. If the functions + - * / operate on bignums (instead of dedicated bignum functions), would that mean we drop 32/64 bit integers entirely? Eli Zaretskii wrote: > The design should IMO be discussed up front, because we want not only > to be able to use bignums and arbitrary-precision floating-point > numbers in C, but also in Lisp. I thought that Eli was talking about how we should interface bignums to Emacs Lisp; the + - * / operators are defined in C source code. Bignums would decrease performance in areas where the usual 32/64 bit integers are sufficient, and lead to higher memory usage. It would make much more sense to have separate math functions for 32/64 bit numbers and for bignums. In doing so, it should be obvious to the Emacs Lisp programmer when to use what. Paul Eggert wrote: > This should be a separate task. Bignums alone are quite a large-enough > project. I'm not even sure we should do rationals. Rationals would be a part of Emacs Calc, once we have bignums it should be trivial to reimplement rationals.