emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Making 'eq' == 'eql' in bignum branch


From: Lars Ingebrigtsen
Subject: Re: Making 'eq' == 'eql' in bignum branch
Date: Wed, 22 Aug 2018 10:26:19 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Slightly off-topic, but I thought it was amusing:

I was reading a blog post on C over/underruns, and I got to this bit:

        Note that there is no value than can hold 2147483648, so if you
        negate (int)0x80000000, you get (int)0x80000000 again. That is
        something to look out for, because it means abs() returns a
        negative value when fed -2147483648.

I didn't know that, and indeed in Emacs until a few weeks ago:

(abs most-negative-fixnum) => -2305843009213693952

Now, of course, with bignum support, we get a more correct result:

(abs most-negative-fixnum) => 2305843009213693952
(bignump (abs most-negative-fixnum)) => t

So now we don't have to fix the documentation of `abs':

---
abs is a built-in function in ‘C source code’.

(abs ARG)

Return the absolute value of ARG.
---


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




reply via email to

[Prev in Thread] Current Thread [Next in Thread]