From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: =?utf-8?B?4oCYdHJ1bmNhdGXigJk=?= on (float-time) causes arith range error on 32bit emacs Date: Fri, 29 Jan 2016 10:49:27 +0200 Message-ID: <83wpqsydm0.fsf@gnu.org> References: <87twlxqe8v.fsf@xi.bootis> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1454057399 19643 80.91.229.3 (29 Jan 2016 08:49:59 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 29 Jan 2016 08:49:59 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jan 29 09:49:54 2016 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aP4kY-0002cP-Hc for geh-help-gnu-emacs@m.gmane.org; Fri, 29 Jan 2016 09:49:50 +0100 Original-Received: from localhost ([::1]:60612 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aP4kX-0000qw-Pc for geh-help-gnu-emacs@m.gmane.org; Fri, 29 Jan 2016 03:49:49 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54493) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aP4kO-0000qo-5o for help-gnu-emacs@gnu.org; Fri, 29 Jan 2016 03:49:41 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aP4kJ-0006R1-2M for help-gnu-emacs@gnu.org; Fri, 29 Jan 2016 03:49:40 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:53134) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aP4kI-0006Qx-VH for help-gnu-emacs@gnu.org; Fri, 29 Jan 2016 03:49:34 -0500 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:3570 helo=HOME-C4E4A596F7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1aP4kH-0006Pw-Uk for help-gnu-emacs@gnu.org; Fri, 29 Jan 2016 03:49:34 -0500 In-reply-to: <87twlxqe8v.fsf@xi.bootis> (message from =?utf-8?B?R8O2a3R1?= =?utf-8?B?xJ8=?= Kayaalp on Fri, 29 Jan 2016 05:02:56 +0200) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:108910 Archived-At: > From: Göktuğ Kayaalp > 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.