Weird bug discovered: decimal string to integer conversion.

 new new list compose Reply to this message Top page
Attachments:
+ (text/plain)

Delete this message
Author: Kaz Kylheku
Date:  
To: TXR Users
Subject: Weird bug discovered: decimal string to integer conversion.
Hi all,

I've discovered an odd bug. On a 32 bit build of TXR, the following
decimal strings incorrectly convert to 0, 1, 2 and 3, respectively:
4294967296, 4294967297, 4294967298, 4294967299.

Furthermore, if we add digits to any of these, for instance
429496729712345, then these digit strings also do not convert correctly.

On a 64 bit build, the bug doesn't manifest itself for these values; the
analogous problem occurs relative to the (expt 2 64) value instead:
decimals beginning with 18446744073709551616, 18446744073709551617,
18446744073709551618 and 18446744073709551619.

This affects situations when decimal tokens in Lisp code/data are
scanned, string to integer conversions and also floating to integer
conversions.

Oops!