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: Eli Zaretskii
Subject: Re: ‘truncate’ on (float-time) causes arith range error on 32bit emacs
Date: Fri, 29 Jan 2016 10:49:27 +0200

> From: Göktuğ Kayaalp <address@hidden>
> Date: Fri, 29 Jan 2016 05:02:56 +0200
> 
>   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?

No.  The usual ways of handling this are either (a) leave the numbers
as floats, and just be more careful about comparisons; and (b)
represent large numbers as cons cells.

Since these are time values, I'd suggest (a) in your case.  What math
requires integers, exactly, and why?

> Interestingly, these values  don't seem to exceed the limits  for 32 bit
> integers, am I wrong?

Lisp integers cannot use the full range of 32 bits, see the manual.
On a 32-bit machine you only have 30 bits for the integers (including
the sign bit).  The maximum value you can use is given by
most-positive-fixnum, and the minimum by most-negative-fixnum.



reply via email to

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