[metapost] independent variables overflow

Taco Hoekwater taco at elvenkind.com
Thu Jan 10 17:43:45 CET 2008


Werner LEMBERG wrote:
> 
> What I really don't understand is that I get this overflow at all!

Both mp and mf have this overflow, and it is a caused by a known
limitation of the implementation. Read on ...

> Why is an `:=' assignment handled as an `independent variable' (in
> MetaFont parlance), especially if all elements on the right side are
> non-variant data elements only?  I looked up the MetaFont source, but
> it is too confusing for me...  Or is something different the cause?

`independent variable' in this case is not a variable name, it is any
variable value that is used in an equation. (in the example, each loop
iteration generates 4 of those: the coordinate values 1, 0, 1, and 1)

Internally, each instantiation of a value (once for each use) needs
a unique identifier to offset it from other values; this is needed for
equation solving (assignments count as equations here because the RHS
can become a term in another equation).

When the 25 bits of range (33mln) that is allowed for these identifiers
has been used up, the serial numbers overflow. This can cause extremely
bad bugs in the output, which is why it is a fatal error.

There is no fix (or even workaround) right now, but this problem is on
the todo list for the next release.

> BTW, the warning comes from an addition in `mf.ch', which adds a check
> for overflow of the serial numbers.

Yes. Before that test was added, the overflow also happened
(as in Jacko's antiquated system), but it was not detected.


Best wishes,
Taco





More information about the metapost mailing list