[metapost] Bugs in mpost 1.202 (and less)?
Taco Hoekwater
taco at elvenkind.com
Mon Jun 8 08:51:46 CEST 2009
Steve Checkoway wrote:
>
> On Jun 6, 2009, at 2:53 AM, Taco Hoekwater wrote:
>
>> The endless loop is an artifact of 32-bit integer wrapping, where
>> 32767+1 == -32767. Because of this, it loops endlessly through all the
>> values from -32767 upto 32767.
>
> 16-bit signed integers have a range of -32768 to 32767 so 32767+1 =
> -32768. 32-bit integers have a range of -2147483648 to 2147483647.
Ah ok, I was off by one. The other 16 bits of the 32-bit integer are
used for fractional parts, so to make this work it would need 64-bit
integers, but these have to be squeezed inside a heap-based data
structure that only accepts 32-bit values, making it somewhat tedious.
If you want to provide a patch to use 64 bit integers for loops that
would be great and I would gladly apply it, but I believe my time is
better spent working on MetaPost2. More so because this bug is a
border case that is easy to work around.
Best wishes,
Taco
More information about the metapost
mailing list