From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: David Sitsky Newsgroups: gmane.emacs.bugs Subject: bug#30408: 24.5; (format "%x" large-number) produces incorrect results Date: Sat, 10 Feb 2018 17:22:53 +1100 Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="001a11410090d141fb0564d5acda" X-Trace: blaine.gmane.org 1518246078 6398 195.159.176.226 (10 Feb 2018 07:01:18 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 10 Feb 2018 07:01:18 +0000 (UTC) To: 30408@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Feb 10 08:01:13 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ekP9n-0000uC-O9 for geb-bug-gnu-emacs@m.gmane.org; Sat, 10 Feb 2018 08:01:07 +0100 Original-Received: from localhost ([::1]:33427 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ekPBn-00047c-Qe for geb-bug-gnu-emacs@m.gmane.org; Sat, 10 Feb 2018 02:03:11 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55782) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ekPBf-00046u-OD for bug-gnu-emacs@gnu.org; Sat, 10 Feb 2018 02:03:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ekPBe-0000Cs-Pw for bug-gnu-emacs@gnu.org; Sat, 10 Feb 2018 02:03:03 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:56330) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ekPBe-0000Cl-Mp for bug-gnu-emacs@gnu.org; Sat, 10 Feb 2018 02:03:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ekPBe-000637-CX for bug-gnu-emacs@gnu.org; Sat, 10 Feb 2018 02:03:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: David Sitsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 10 Feb 2018 07:03:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 30408 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.151824616223224 (code B ref -1); Sat, 10 Feb 2018 07:03:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 10 Feb 2018 07:02:42 +0000 Original-Received: from localhost ([127.0.0.1]:35994 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ekPBJ-00062W-UM for submit@debbugs.gnu.org; Sat, 10 Feb 2018 02:02:42 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:37583) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ekOYx-00053i-UA for submit@debbugs.gnu.org; Sat, 10 Feb 2018 01:23:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ekOYr-0000bP-PL for submit@debbugs.gnu.org; Sat, 10 Feb 2018 01:22:58 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:58007) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ekOYr-0000b9-KQ for submit@debbugs.gnu.org; Sat, 10 Feb 2018 01:22:57 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56747) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ekOYq-0008Ep-Co for bug-gnu-emacs@gnu.org; Sat, 10 Feb 2018 01:22:57 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ekOYp-0000Yx-4i for bug-gnu-emacs@gnu.org; Sat, 10 Feb 2018 01:22:56 -0500 Original-Received: from mail-io0-x22f.google.com ([2607:f8b0:4001:c06::22f]:37472) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ekOYp-0000YQ-0B for bug-gnu-emacs@gnu.org; Sat, 10 Feb 2018 01:22:55 -0500 Original-Received: by mail-io0-x22f.google.com with SMTP id f89so12089572ioj.4 for ; Fri, 09 Feb 2018 22:22:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=RzJRBGH1BN1NXbidAQlLGOM8yezKyZeAhcOMb3AhYpY=; b=U9yBaHDssDnT/3tuJpYcp7AU9isYinuusMPB7k0ZoIpdBG659cZPBtjEzvhjx7dAHn hSqzODehJ/C6L1TFebSuXDA0vuUXXVuYQWhv25YfBmORWa645/U7CIW+HJ3QU+X/VzaJ og/+cOKu52r5NrrNSy3zndZMKK3EsCzvHPPTlfEXJ4UCLJMTzLFvQ/zu/U3zexaMgF+O dUuKDCiM+rdxv5krO4GGm6pSfT+HkMEnQErYum4IDwDpHhMhlG9PzEBRolE1PRu2f87z TgTxkUzEZezlVQIXjeZy1NPeLwbGYX1bCIltlF3Vg3SU+2jqjxErNjISOKAlFZv3Vba/ JpAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=RzJRBGH1BN1NXbidAQlLGOM8yezKyZeAhcOMb3AhYpY=; b=dATUwNLhTkwxEDy4UOr6oCR2ZRUCWdPMQpaaVF2gWbcMONDIVLwQi/2SML3jJYL7Ri 7p8X3Ys7lc4LORHdXMgBahtdKUH3KRen04YIxoZsZgxne1Jus42j0907VqQw7nfla/oN ZUTRPxcpogL/pSzloCUKQ/6se4UShTOTFLExBAM8AFh6BWX/2io+9SIZLZgbxOrU7j5T 0OblDpkQQOs4SSYKntZ/Dj5JAFrr9naGwO99kUX6SShFka4/VjtRWipZFBHxv4rDNXhX w2S4KJw1L9dTVsYBDieym4kPbbaivc6T73wDUO3po79HiKEr/PbCX70JI+MFgDsPHiUq 3OuQ== X-Gm-Message-State: APf1xPBOl5U+LixTwbT8alLGTbfx1MZ1z4E9hYEOG80sklUzXq/Qdfzw UIf6TVHVrLtOr3WjJX8SCMQ7YYmfeqZEuDqovwQp0m8+ X-Google-Smtp-Source: AH8x2253F+WAQzQn7rsqiJNbdQzOxuCQK8VtKt09KCfNogUKPBs+jNQPQ83C8QCVA1PANSmGVb0d9Uce/crxKAhpr9s= X-Received: by 10.107.161.205 with SMTP id k196mr5943328ioe.253.1518243773758; Fri, 09 Feb 2018 22:22:53 -0800 (PST) Original-Received: by 10.107.184.85 with HTTP; Fri, 9 Feb 2018 22:22:53 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Mailman-Approved-At: Sat, 10 Feb 2018 02:02:40 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:143071 Archived-At: --001a11410090d141fb0564d5acda Content-Type: text/plain; charset="UTF-8" I wrote this originally on https://emacs.stackexchange.com/questions/38710/why-does-format-x-some-large-number-produces-incorrect-results and a poster recommended I mention this here. I wanted the hexadecimal string for a large integer such as below: (format "%x" 2738188573457603759) This returns 2600000000f95c00 which is incorrect, it should be 2600000000f95caf. The value of most-positive-fixnum on my box is 0x1fffffffffffffff which is less than the number I'm supplying above. As a user I'm a bit baffled what is happening. The manual indicates integers larger than this range are converted to a floating-point number which is a concern for precision but I suspect this is what is biting me here? I should have known there was an issue with this number since normally I evaluate them directly using eval-last-sexp and it didn't show the octal/hex variants.. :) I wonder why Emacs Lisp doesn't support bignums by default, so precision would not be an issue? --001a11410090d141fb0564d5acda Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I wrote this originally on=C2=A0https://emacs.stackexchange.com/questions/38710/why-d= oes-format-x-some-large-number-produces-incorrect-results and a poster = recommended I mention this here.

I wanted the hexadecimal str= ing for a large integer such as below:

(format "%x" 273818= 8573457603759)

This returns 2600000000f95c00 which is incorrect, it = should be 2600000000f95caf.

The value of most-positive-fixnum on my = box is 0x1fffffffffffffff which is less than the number I'm supplying a= bove.

As a user I'm a bit baffled what is happening. The manual = indicates integers larger than this range are converted to a floating-point= number which is a concern for precision but I suspect this is what is biti= ng me here?

I should have known there was an issue with this number = since normally I evaluate them directly using eval-last-sexp and it didn= 9;t show the octal/hex variants.. :)

I wonder why Emacs Lisp doesn&#= 39;t support bignums by default, so precision would not be an issue?
--001a11410090d141fb0564d5acda--