unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: ‘truncate’ on (float-time) causes arith range error on 32bit emacs
Date: Fri, 29 Jan 2016 10:49:27 +0200	[thread overview]
Message-ID: <83wpqsydm0.fsf@gnu.org> (raw)
In-Reply-To: <87twlxqe8v.fsf@xi.bootis> (message from Göktuğ Kayaalp on Fri, 29 Jan 2016 05:02:56 +0200)

> From: Göktuğ Kayaalp <self@gkayaalp.com>
> 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	other threads:[~2016-01-29  8:49 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 [this message]
2016-01-29  9:55 ` Andy Moreton
  -- 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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83wpqsydm0.fsf@gnu.org \
    --to=eliz@gnu.org \
    --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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).