[comp.text.tex] Unexpected Overflow in TeX

jjsf@gmv.es (Julio Sanchez) (03/01/90)

The following TeX program bombs with arithmetic overflow:

\newcount\total
\total=1
\loop
\iftrue
\multiply\total by 2
\immediate\write16{\number\total}
\repeat
\bye

Now, the problem is that it bombs too soon. Acoording to the TeXbook,
page 118, overflow happens when the result exceeds the register
capability. Same page also says that the \count registers capability
is -2147483647 to 2147483647.

I have tried it on both Sun TeX (2.9) and on VAX/VMS TeX (some older
version). Also the following code bombs:

\newcount\total
\total=1234567890
\divide\total by 1000
\multiply\total by 1000
\bye

But it bombs in the multiply, with the funny result that I
cannot put into a register a number that is guaranteed to be
at most as large as a number I have already put into it.

Would some nice soul out there tell me to RTFM (with pointer)
whether it is a bug and which version has it corrected, or
any useful information on this?

Yours puzzled,


Julio Sanchez                            Ph. +34 1 534 30 04
Grupo de Mecanica del Vuelo, S.A. (GMV)  Fax +34 1 533 32 50
Cristobal Bordiu, 35                     Telex  48487 GMEV E
E-28003 MADRID                           jsanchez@gmv.es
SPAIN                                    mcsun!gmv.es!jsanchez@uunet.uu.net
                                         uunet!mcsun!gmv.es!jsanchez