[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Using the GNU GMP Library for Bignums in Emacs
From: |
Helmut Eller |
Subject: |
Re: Using the GNU GMP Library for Bignums in Emacs |
Date: |
Tue, 24 Apr 2018 07:45:30 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) |
On Mon, Apr 23 2018, Paul Eggert wrote:
> Even in the standard C library (which lacks bignums), the %x printf
> format is supposed to be used only with unsigned integers. Nowadays
> GCC even optionally warns about using %x on signed integers.
Maybe %x should then print the (shortest) two's complement
representation for bignums. In Common Lisp:
(defun 2comp (x)
(format nil "~x" (logand x (1- (ash 1 (+ 1 (integer-length x)))))))
(2comp -1) => "1"
(2comp -2) => "2"
(2comp -3) => "5"
(2comp -15) => "11"
(2comp -16) => "10"
In practice, only integers smaller than most-negative-fixnum would use
this rule.
Helmut
- Re: Using the GNU GMP Library for Bignums in Emacs, (continued)
- Re: Using the GNU GMP Library for Bignums in Emacs, Richard Stallman, 2018/04/22
- Re: Using the GNU GMP Library for Bignums in Emacs, Helmut Eller, 2018/04/22
- Re: Using the GNU GMP Library for Bignums in Emacs, Paul Eggert, 2018/04/22
- Re: Using the GNU GMP Library for Bignums in Emacs, Richard Stallman, 2018/04/22
- Re: Using the GNU GMP Library for Bignums in Emacs, Paul Eggert, 2018/04/23
- Re: Using the GNU GMP Library for Bignums in Emacs, Richard Stallman, 2018/04/23
- Re: Using the GNU GMP Library for Bignums in Emacs, Paul Eggert, 2018/04/24
- Re: Using the GNU GMP Library for Bignums in Emacs,
Helmut Eller <=
- Re: Using the GNU GMP Library for Bignums in Emacs, Richard Stallman, 2018/04/24
- Re: Using the GNU GMP Library for Bignums in Emacs, Paul Eggert, 2018/04/24
- Re: Using the GNU GMP Library for Bignums in Emacs, Richard Stallman, 2018/04/25
- Re: Using the GNU GMP Library for Bignums in Emacs, Paul Eggert, 2018/04/25
- Re: Using the GNU GMP Library for Bignums in Emacs, Richard Stallman, 2018/04/29
- Re: Using the GNU GMP Library for Bignums in Emacs, Michael Welsh Duggan, 2018/04/30
- Re: Using the GNU GMP Library for Bignums in Emacs, Stefan Monnier, 2018/04/30
- Re: Using the GNU GMP Library for Bignums in Emacs, Richard Stallman, 2018/04/30
- Re: Using the GNU GMP Library for Bignums in Emacs, Paul Eggert, 2018/04/30
- Re: Using the GNU GMP Library for Bignums in Emacs, Richard Stallman, 2018/04/30