From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Simon Leinen Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Re: Bignum performance Date: Fri, 18 Aug 2023 09:14:43 +0200 Message-ID: References: <874jkzllqq.fsf@yahoo.com> <2dec78a7-76e0-8789-4d20-7f0f6effe28a@gmail.com> <87pm3neei7.fsf@dataswamp.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="00000000000016c90506032d4938" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1938"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Aug 18 09:15:56 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qWti8-0000Df-JX for ged-emacs-devel@m.gmane-mx.org; Fri, 18 Aug 2023 09:15:56 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qWthI-0000m7-5r; Fri, 18 Aug 2023 03:15:04 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qWthF-0000ld-BN for emacs-devel@gnu.org; Fri, 18 Aug 2023 03:15:01 -0400 Original-Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qWthC-0007HM-N4 for emacs-devel@gnu.org; Fri, 18 Aug 2023 03:15:01 -0400 Original-Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-319559fd67dso564525f8f.3 for ; Fri, 18 Aug 2023 00:14:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692342895; x=1692947695; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=VFOXFIFwh5u1DAdpQtpfFTUhzxS3/Dg6DxQr6Mc7C/Y=; b=oDLgVUutAKDZv7Bj6f3hTXb9T1fHsKfa2bH1ZMiQV4AFR7+zKLOqaP3+rprZmgsRlz EEXtlgs0k6TRfWfpFVYzth6GaW6BgLZKVV2TGaPvF/qOvQNE1kD5Uhjg39BYngLAa6gV y1XiMOxtvu/IGH1ERIa67I8N9t1kSuYpcUUJAToLtn71sdBl1lQMrQT9AiKJKmvHJgfs lAlI+yCNaF+wTdMO1syD5I4vs3zOV0SmrCHWyjzFFVbDBUsb+KXjeC7sP+bVjsLyQ+o2 cQPRJ7+Dd3G+Dx7ZmUd2AIQvDvN/NH8u+u6HujUnxnsQ9pGdIZDAh3bGLyU7y4kU+7yw f/ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692342895; x=1692947695; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=VFOXFIFwh5u1DAdpQtpfFTUhzxS3/Dg6DxQr6Mc7C/Y=; b=CtAdZVvX1OGTcn+R8z4fWDvhMcxe9ursJ41ONyKx11/t4aDHU5qVvPAcreifiRXl0o 0tChFpOOrmQPXrqE1xyI5ESx1nwwxqP6VXYd5CESCh+4jtfGJFtEFLvH0LS41nzEa0WE x59iNo9V2wH03TJtK1+PMBdPbUZBjwt+whhZWNRX8j9O53liDnHVMbvaP9nI4xwsN/of pE1syQWoFVdn/gI/0Cn5+JdLOQm2aU+MAtdeOqCun8MCS7mIuNM+WpTwdz/PSHjvSbEq 5TgQliBa0T/qzKyRipLH3BGoD7ZEabVpVBK3ioA+/0THqfxjsIQphbLIMJaGgklTt/N3 9tOw== X-Gm-Message-State: AOJu0Yw4NGjagviG+sFfT9W/xfBTTjg9dBs8blPLe1k7qKj5TaZp/zAt qjfNb2P77cGeiid1U4WI1C/fxaXvWgf2Ou7tVo1RIsYIuxQ= X-Google-Smtp-Source: AGHT+IG4vhnlcRGsTMqe4pwsNMqhSUYpWlaScz3LtFwDcCfiaI7+3uvAdzB2q1WM4x4JJeYsSDXd2Xfks3ZssWQlFwo= X-Received: by 2002:a05:6000:11:b0:31a:d90e:42cd with SMTP id h17-20020a056000001100b0031ad90e42cdmr1245014wrx.35.1692342894904; Fri, 18 Aug 2023 00:14:54 -0700 (PDT) In-Reply-To: <87pm3neei7.fsf@dataswamp.org> Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=simon.leinen@gmail.com; helo=mail-wr1-x42e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:308886 Archived-At: --00000000000016c90506032d4938 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Emacs also has `most-negative-fixnum' and `most-positive-fixnum' (borrowed from Common Lisp but now part of the core). On my 64-bit system (GNU Emacs 30.0.50 on aarch64-apple-darwin22.5.0): (=3D (- (expt 2 61)) most-negative-fixnum) =E2=87=92 t (=3D (1- (expt 2 61)) most-positive-fixnum) =E2=87=92 t (Same as on Emanuel's.) --=20 Simon. On Wed, Aug 16, 2023 at 1:12=E2=80=AFPM Emanuel Berg = wrote: > Gerd M=C3=B6llmann wrote: > > >> I don't know about SBCL, but as for Emacs, refer to the > >> definition of VALBITS in lisp.h (maybe also the right files > >> among m/*.h and s/*.h, but I have no idea where they've > >> disappeared to.) > > > > The SBCL I have here, a Homebrew installation, uses the > > scheme where > > > > ....0 -> fixnum > > ....1 -> other objects (discriminated by additional tag bits) > > > > I had the same for Emacs in the branch gerd_int in the > > 2000s, if memory serves me. > > Ah, there is `fixnump' (and `bignump') to test for a specific > number, > > (fixnump (expt 2 60)) ; t > (fixnump (expt 2 61)) ; nil > > 2^60 =3D 1152921504606846976, so that's pretty big. > > -- > underground experts united > https://dataswamp.org/~incal > > > --00000000000016c90506032d4938 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Emacs also has `most-negative-fixnum' and `most-positi= ve-fixnum' (borrowed from Common Lisp but now part of the core).
On my 64-bit system (GNU Emacs 30.0.50 on=C2=A0aarch64-apple-d= arwin22.5.0):

(=3D (- (expt 2 61)) most-negative-fixnum= ) =E2=87=92 t
(=3D (1- (expt 2 61)) most-positive-fixnum) =E2=87=92 t

(Same as on Emanuel's.)
--=C2=A0
Simon.

On Wed, Aug 16, 2023 at 1:12=E2=80=AFPM Emanuel Berg <= ;incal@dataswamp.org> wrote:<= br>
Gerd M=C3=B6llma= nn wrote:

>> I don't know about SBCL, but as for Emacs, refer to the
>> definition of VALBITS in lisp.h (maybe also the right files
>> among m/*.h and s/*.h, but I have no idea where they've
>> disappeared to.)
>
> The SBCL I have here, a Homebrew installation, uses the
> scheme where
>
> ....0 -> fixnum
> ....1=C2=A0 =C2=A0-> other objects (discriminated by additional tag= bits)
>
> I had the same for Emacs in the branch gerd_int in the
> 2000s, if memory serves me.

Ah, there is `fixnump' (and `bignump') to test for a specific
number,

=C2=A0 (fixnump (expt 2 60)) ; t
=C2=A0 (fixnump (expt 2 61)) ; nil

2^60 =3D 1152921504606846976, so that's pretty big.

--
underground experts united
https://dataswamp.org/~incal


--00000000000016c90506032d4938--