help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Inconsistency: sometimes an integer, sometimes a float


From: Nicolas Richard
Subject: Re: Inconsistency: sometimes an integer, sometimes a float
Date: Thu, 23 Jan 2014 17:07:32 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Err, sorry for previous message, it was sent by accident.

djc <peter.kaiser@gmail.com> writes:
> "(/ 536870911 1000000)" is an integer.
> "(/ 536870912 1000000)" is a float.

What I was saying is : I can reproduce this from -Q :

/tmp $ emacs -Q --batch  --eval '(message "%s" (type-of (/ 536870912 1000000)))'
float
/tmp $ emacs --version
GNU Emacs 24.3.50.2
(...)

It's because:
$ emacs -Q --batch  --eval '(message "%s" (type-of 536870912))'
float

which itself comes from:
$ emacs -Q --batch  --eval '(message "%s" (> 536870912 most-positive-fixnum))'
t

explanation at:
(info "(elisp) Integer Type")

,----
| As a special exception, if a sequence of digits specifies an integer
| too large or too small to be a valid integer object, the Lisp reader
| reads it as a floating-point number (*note Floating Point Type::).  For
| instance, if Emacs integers are 30 bits, `536870912' is read as the
| floating-point number `536870912.0'.
`----

HTH,

-- 
Nico.



reply via email to

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