GNU bug report logs - #5114
23.1.50; (string-to-number (number-to-string most-positive-fixnum))

Previous Next

Package: emacs;

Reported by: Helmut Eller <eller.helmut <at> gmail.com>

Date: Thu, 3 Dec 2009 15:05:07 UTC

Severity: normal

Tags: fixed

Fixed in version 24.1

Done: Lars Magne Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #10 received at 5114 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Helmut Eller <eller.helmut <at> gmail.com>
Cc: 5114 <at> debbugs.gnu.org
Subject: Re: bug#5114: 23.1.50; (string-to-number (number-to-string most-positive-fixnum))
Date: Thu, 03 Dec 2009 15:52:16 -0500
> (setq x (string-to-number (number-to-string most-positive-fixnum)))
> (= most-positive-fixnum x) => nil
   
> x is 2305843009213693440 but it should be most-positive-fixnum
> which is 2305843009213693951.

> The test
> (= most-positive-fixnum 
>    (string-to-number (number-to-string most-positive-fixnum)))
> seems to work as expected on 32-bit machines but not so on 64 bit.

Indeed, it passes through a floating point conversion, so there's only
abour 52 bit of precesion.


        Stefan



This bug report was last modified 13 years and 290 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.