\documentclass[preprint]{ltugboat}
\usepackage{shortvrb}
\usepackage{url}

\providecommand{\meta}[1]{\ensuremath{\langle\textit{#1}\rangle}}
\makeatletter
\providecommand{\eTeX}{$\m@th\varepsilon$-\TeX}
\makeatother
\hyphenation{pa-ra-me-ter}

\emergencystretch=4mm
\title{Purging \TeX\ from floating-point arithmetic}
\author{Matthias Clasen}
%\address{}
\netaddress{maclas@gmx.de}
\setcounter{page}{1}

\begin{document}
\maketitle
\MakeShortVerb{\|}

\section{Introduction}

\TeX\ uses machine-dependent floating-point arithmetic for its
internal glue computations. This is the reason why a (undoubtly very useful) 
general |\lastnode| command cannot be added to \TeX\ without risking
the portability of documents.
 
A long time ago, Knuth demonstrated how to implement \TeX's glue computations
in fixed-point arithmetic\cite{Knuth:82,Knuth:91}. Knuth mentions that his
code would have to be slightly generalized before it can be used in \TeX. To
my knowledge, this has not been done before. 

After applying my change file, |tex.web| no longer contains any
variables of type |real|, proving that I was successful in removing all
floating-point arithmetic from \TeX. I have not implemented the (now possible)
|\lastnode| primitive. 

\section{Implementation}

The changes to \TeX{} the program sketched above are realized in the
change file |glue.ch|, which is a rewrite of Knuth's |glue.web|. 

\section{Installation}
 
 The change files are written for \TeX~3.1459. But it should need only
 cosmetic changes to get them to work with other versions of \TeX3.

 To make the change files for \TeX{} work, you have to apply the change file
 |pre.ch| first. I have only tried these files with |web2c|, and
 for that you need to surround the |web2c| change file with |pre-web2c.ch| and
 |post-web2c.ch|. You also need the additional change file 
 |glue-post-web2c.ch| and the patch file |glueratio.patch|.
 The patch file is necessary, since |web2c| fixes the type |glueratio|
 to be |double| in a file which is not subject to the |web| translation
 process. The patch file changes this to the new type |glueratio| if
 the |cpp| macro |HAVE_GLUERATIO_TYPE| is defined.

 All this boils down to the command line

\begin{verbatim}
mv tex.ch tex.ch.orig
tie -c tex.ch tex.web pre.ch glue.ch \ 
       pre-web2c.ch tex.ch.orig \
       post-web2c.ch glue-post-web2c.ch
patch < glueratio.ch
export XCFLAGS=-DHAVE_GLUERATIO_TYPE
\end{verbatim}

 \makesignature

 \bibliographystyle{plain}
 \bibliography{etex}

\end{document}
