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

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

Re: ‘truncate’ on (float-time) causes arith range error on 32bit emacs


From: Andy Moreton
Subject: Re: ‘truncate’ on (float-time) causes arith range error on 32bit emacs
Date: Fri, 29 Jan 2016 09:55:00 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (windows-nt)

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





reply via email to

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