From: Andy Moreton <andrewjmoreton@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: ‘truncate’ on (float-time) causes arith range error on 32bit emacs
Date: Fri, 29 Jan 2016 09:55:00 +0000 [thread overview]
Message-ID: <86bn84iubv.fsf@gmail.com> (raw)
In-Reply-To: 87twlxqe8v.fsf@xi.bootis
On Fri 29 Jan 2016, Göktuğ Kayaalp wrote:
> Hi all,
>
> I've a little package [1]. A user reported to me this error:
>
> Contacting host: api.forecast.io:443
> Opening TLS connection to `api.forecast.io'...
> Opening TLS connection with `gnutls-cli --insecure -p 443 api.forecast.io'...done
> Opening TLS connection to `api.forecast.io'...done
> error in process sentinel: let*: Arithmetic range error: "truncate", 1454005216.6590292
> error in process sentinel: Arithmetic range error: "truncate", 1454005216.6590292
> error in process filter: let*: Arithmetic range error: "truncate", 1454005218.8166773
> error in process filter: Arithmetic range error: "truncate", 1454005218.8166773
> error in process sentinel: let*: Arithmetic range error: "truncate", 1454005220.8661127
> error in process sentinel: Arithmetic range error: "truncate", 1454005220.8661127
>
> He is on a 32bit pc. These errors come from a function in which I
> truncate some timestamps for some math that requires integers. Is there
> a way to convert it to integer w/o error on a 32 bit machine?
>
> Interestingly, these values don't seem to exceed the limits for 32 bit
> integers, am I wrong? Is there sth. different going on that I did not
> catch? I'm rather novice with elisp, so sorry if I'm missing
> sth. obvious and blundering the list.
The Emacs integer representation is not the same size as a native
machine integer, and the values you are using here are out of range.
See the elisp manual: (info "(elisp) Integer Basics").
For example:
(version) ; => "GNU Emacs 25.0.50.6 (i686-pc-mingw32) of 2016-01-29"
most-positive-fixnum ; => 536870911
most-negative-fixnum ; => -536870912
(1+ 1454005216) ; => 1454005217.0
Note how the last result is a float.
HTH
AndyM
next prev parent reply other threads:[~2016-01-29 9:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-29 3:02 ‘truncate’ on (float-time) causes arith range error on 32bit emacs Göktuğ Kayaalp
2016-01-29 8:49 ` Eli Zaretskii
2016-01-29 9:55 ` Andy Moreton [this message]
-- strict thread matches above, loose matches on Subject: below --
2016-02-03 18:09 Göktuğ Kayaalp
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86bn84iubv.fsf@gmail.com \
--to=andrewjmoreton@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.