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: Sun, 22 Apr 2018 15:00:49 +0700 Message-ID: <8e12135a-0fcc-7aa3-d000-731d2f26d918@disroot.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> 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 1524383982 4227 195.159.176.226 (22 Apr 2018 07:59:42 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 22 Apr 2018 07:59:42 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 Cc: eliz@gnu.org, eggert@cs.ucla.edu, emacs-devel@gnu.org To: rms@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Apr 22 09:59:38 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 1fA9uL-0000y5-Dv for ged-emacs-devel@m.gmane.org; Sun, 22 Apr 2018 09:59:38 +0200 Original-Received: from localhost ([::1]:35709 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fA9wQ-0006jG-5C for ged-emacs-devel@m.gmane.org; Sun, 22 Apr 2018 04:01:46 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55359) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fA9vj-0006iD-1r for emacs-devel@gnu.org; Sun, 22 Apr 2018 04:01:03 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fA9vi-00057j-8N for emacs-devel@gnu.org; Sun, 22 Apr 2018 04:01:03 -0400 Original-Received: from knopi.disroot.org ([178.21.23.139]:55734) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fA9vd-00054H-Er; Sun, 22 Apr 2018 04:00:57 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id 183CD2DE0A; Sun, 22 Apr 2018 10:00:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1524384055; bh=JIdNu7lpxsScUjq5i9R6pseNn02gaDp+cYXRgSng68g=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=DxeGlU44h+EpdTfbNUI2Me0+5lenBIgmNecF8VaaTKIRfS/Y0t/TDNSVHnLF/aLs4 BLNOLdsGgjJ6EzUEy6Te9aVVCYcMPQsEAPW6Z6YxWrh1pOwK5/oIK94mMyWLlVCZRz eURmbGRnc0VvwAUYN3DfDhzm+F1ISSgQGhKatyW/AJJuZH6+FvQ60JsA1QSNyA9Ewe 1rxtwVQS95AIJW//5Al9ets6ojoRCcLrj7ZvpwEBYk7NDYp3078gAh5uP22A0EfcyX SI3nWbD1vE0DfmYi4Ssu4AtG9jLT3kwia/ylTpoM8v1yooVD65NRBkHsXGliVXYj4Z 3HB0UW5x18DLg== 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 aQJjdN_kUgUg; Sun, 22 Apr 2018 10:00:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1524384053; bh=JIdNu7lpxsScUjq5i9R6pseNn02gaDp+cYXRgSng68g=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=KAb0dU+WQDm7WnyJ+kHGUUR6eaQwIdsFpFl6o+qjjTG+kkFTmm3lzdyHm/o+njsOo EYE8dQIrnQB6mX/HLciTZPH/O7/4aJu+MGyRyh4PoLuhmDzSsSLFxJGWqbWTs0/xvH iV/NjQp6JPqbmiktdQ+ArI8meEIzHqr9beBjo6KD/ZpAf+/f2YnO+7wMAm0CGh2Uej MxgOMyT7QGAUbo4JwAvBH0r9ItrUNTGKBkNdsCfaWHFKMAye0d4bFNGVijGnXi1xZs /7jdnBskrXcZRY8oeT3+Uwt+mcKbAO5vV1G/EKx60B/hg2Ho8dpwKOo694VzqwaX0a H2bNIeIY0Irlw== In-Reply-To: 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:224782 Archived-At: Richard Stallman wrote: > To eliminate the current types for small integers would > require rewriting of much of the C code in Emacs. > It would be better to represent small integers as now, > and have a different structure for larger integers. From what I understand, we would want to use fixnums by default in the C code, and convert to bignums automatically (in lisp) when the number exceeds the range of a fixnum, while retaining behavior as before, using the regular math operations + - * / (and more) to interface this to Lisp. Paul Eggert wrote: > programs wouldn't care whether an integer is represented via fixnum or > bignum, as it'd be an issue merely of efficiency. Would it not slow down computation to have to constantly convert between the two types? (especially if the computation is switching above/below the fixnum/bignum boundary). In such a case, a fix could be to convert lisp numbers exceeding fixnum limits to bignums for the rest of the number's life (until GC). This ensures memory usage is kept low for fixnum computations.