From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Using the GNU GMP Library for Bignums in Emacs Date: Sat, 21 Apr 2018 18:54:00 +0300 Message-ID: <837ep0y2qv.fsf@gnu.org> References: <29f933ac-a6bf-8742-66a7-0a9d6d3e5a88@disroot.org> <83bmecy6fx.fsf@gnu.org> <0d3175d8-d996-651e-b221-71978bde3a65@cs.ucla.edu> <51e619e0-ee38-eb97-6c1d-0925b675290a@disroot.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1524325947 30166 195.159.176.226 (21 Apr 2018 15:52:27 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 21 Apr 2018 15:52:27 +0000 (UTC) Cc: eggert@cs.ucla.edu, emacs-devel@gnu.org To: "Siraphob \(Ben\) Phipathananunth" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Apr 21 17:52:22 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 1f9uoH-0007gY-G8 for ged-emacs-devel@m.gmane.org; Sat, 21 Apr 2018 17:52:21 +0200 Original-Received: from localhost ([::1]:54087 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f9uqJ-0003b4-0F for ged-emacs-devel@m.gmane.org; Sat, 21 Apr 2018 11:54:27 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44076) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f9uqB-0003Zw-7a for emacs-devel@gnu.org; Sat, 21 Apr 2018 11:54:20 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f9uq6-000478-EZ for emacs-devel@gnu.org; Sat, 21 Apr 2018 11:54:19 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:35513) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f9uq6-000472-AR; Sat, 21 Apr 2018 11:54:14 -0400 Original-Received: from [176.228.60.248] (port=3342 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1f9uq5-0005Bi-Mw; Sat, 21 Apr 2018 11:54:14 -0400 In-reply-to: <51e619e0-ee38-eb97-6c1d-0925b675290a@disroot.org> (siraben@disroot.org) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e 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:224768 Archived-At: > Cc: emacs-devel@gnu.org > From: "Siraphob (Ben) Phipathananunth" > Date: Sat, 21 Apr 2018 22:40:05 +0700 > > I thought that Eli was talking about how we should interface bignums > to Emacs Lisp; the + - * / operators are defined in C source > code. I never thought we could consider not using + - * etc. with bignums, so I didn't even raise that issue. > 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. When the arguments are bignums, these operators should automatically invoke the relevant GMP functions. That is how we behave elsewhere in Emacs; Emacs Lisp does support polymorphism on the level of primitive functions. E.g., that's how these operators support both Lisp integers and Lisp floats (and markers, for that matter).