| 1 |
% \iffalse META-COMMENT |
| 2 |
% |
| 3 |
% The fltpoint package for use with TeX / LaTeX |
| 4 |
% Current Version: 1.1b, dated 2004/11/12 |
| 5 |
% Copyright 2000-2004 |
| 6 |
% Eckhart Guthoehrlein |
| 7 |
% e-mail <[email protected]> |
| 8 |
% |
| 9 |
% This program may be distributed and/or modified under the |
| 10 |
% conditions of the LaTeX Project Public License, either version 1.2 |
| 11 |
% of this license or (at your option) any later version. |
| 12 |
% The latest version of this license is in |
| 13 |
% http://www.latex-project.org/lppl.txt |
| 14 |
% and version 1.2 or later is part of all distributions of LaTeX |
| 15 |
% version 1999/12/01 or later. |
| 16 |
% |
| 17 |
% This program consists of the files 'fltpoint.dtx', 'fltpoint.ins' |
| 18 |
% and 'README_fltpoint.txt'. |
| 19 |
% |
| 20 |
% The package provides simple arithmetic with TeX. It should work with |
| 21 |
% all formats and has been tested with plain TeX and LaTeX. |
| 22 |
% |
| 23 |
% Run TeX over fltpoint.ins to produce the docstripped version |
| 24 |
% of the file. The documentation can be typeset by running |
| 25 |
% LaTeX over fltpoint.dtx. |
| 26 |
% |
| 27 |
% Comments and bug-reports are welcome under the above |
| 28 |
% e-mail address. |
| 29 |
% |
| 30 |
% \fi ^^A end meta-comment |
| 31 |
% \CheckSum{1150} |
| 32 |
% \CharacterTable |
| 33 |
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z |
| 34 |
% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z |
| 35 |
% Digits \0\1\2\3\4\5\6\7\8\9 |
| 36 |
% Exclamation \! Double quote \" Hash (number) \# |
| 37 |
% Dollar \$ Percent \% Ampersand \& |
| 38 |
% Acute accent \' Left paren \( Right paren \) |
| 39 |
% Asterisk \* Plus \+ Comma \, |
| 40 |
% Minus \- Point \. Solidus \/ |
| 41 |
% Colon \: Semicolon \; Less than \< |
| 42 |
% Equals \= Greater than \> Question mark \? |
| 43 |
% Commercial at \@ Left bracket \[ Backslash \\ |
| 44 |
% Right bracket \] Circumflex \^ Underscore \_ |
| 45 |
% Grave accent \` Left brace \{ Vertical bar \| |
| 46 |
% Right brace \} Tilde \~} |
| 47 |
% |
| 48 |
% |
| 49 |
% \DoNotIndex{\def,\edef,\xdef,\gdef,\let,\global,\the,^^A |
| 50 |
% \newcount,\if,\ifx,\else,\fi,\ifnum,\catcode,^^A |
| 51 |
% \@,\expandafter,\csname,\endcsname,\number^^A |
| 52 |
% \relax,\end,\advance,\multiply,\divide,\endinput^^A |
| 53 |
% \iterate,\body,\repeat,\iiterate,\ibody,\irepeat,^^A |
| 54 |
% \xiterate,\xbody,\xrepeat. |
| 55 |
% \,,\active,\AlsoImplementation,\AtBegin\Document, |
| 56 |
% \begin,\CodelineIndex,\CommaCheck,\CommaOrdinary, |
| 57 |
% \CommaPunct,\DeclareOption,\DisableCrossrefs, |
| 58 |
% \DocInput,\documentclass,\EnableCrossrefs,\endinput, |
| 59 |
% \futurelet,\long,\mathchardef,\mathcode,\mbox, |
| 60 |
% \NeedsTeXFormat,\newcommand,\noexpand,\number, |
| 61 |
% \obeyspaces,\OnlyDescription,\ProcessOptions, |
| 62 |
% \ProvidesPackage,\RecordChanges,\rightarrow, |
| 63 |
% \space,\tt,\usepackage} |
| 64 |
% |
| 65 |
% \MakeShortVerb{\"} |
| 66 |
% |
| 67 |
% \changes{v1.0a}{2000/08/23}{First public release} |
| 68 |
% \changes{v1.0b}{2000/08/25}{Some spaces sneaked into the output. |
| 69 |
% Fixed.} |
| 70 |
% \changes{v1.0c}{2000/09/05}{Changes necessary for |
| 71 |
% the \texttt{rccol} package.} |
| 72 |
% \changes{v1.1}{2001/11/17}{Cleanup to freeze development.} |
| 73 |
% \changes{v1.1b}{2004/11/12}{Some more freezing cleanup.} |
| 74 |
% \GetFileInfo{fltpoint.sty} |
| 75 |
% \title{The \texttt{fltpoint} package\thanks{This |
| 76 |
% file has version number \fileversion{} dated \filedate.}} |
| 77 |
% \author{Eckhart Guth\"ohrlein\thanks{Send comments |
| 78 |
% or bug-reports to the author via e-mail |
| 79 |
% \texttt{<e\_w\[email protected]>}.}} |
| 80 |
% \date{Printed \today} |
| 81 |
% \maketitle |
| 82 |
% |
| 83 |
% \begin{abstract} |
| 84 |
% This package provides commands for simple |
| 85 |
% arithmetic with generic \TeX. At the moment, there is support for the |
| 86 |
% basic operations addition, subtraction, multiplication and division as |
| 87 |
% well as for rounding numbers to a given precision. |
| 88 |
% \end{abstract} |
| 89 |
% |
| 90 |
% \newif\ifmulticols |
| 91 |
% \IfFileExists{multicol.sty}{\multicolstrue}{} |
| 92 |
% \ifmulticols |
| 93 |
% \addtocontents{toc}{\protect\begin{multicols}{2}} |
| 94 |
% \fi |
| 95 |
% ^^A{\parskip0mm\tableofcontents} |
| 96 |
% |
| 97 |
% \section{Introduction} |
| 98 |
% The need for calculations inside \TeX\ was encountered when working on |
| 99 |
% some macros to convert positions on a linear scale into angle values, |
| 100 |
% since integer values proved not to be sufficiently exact. Although |
| 101 |
% the capabilities of this package are currently rather limited, |
| 102 |
% they may be of some use if you do not need more than the |
| 103 |
% provided functions. The \texttt{rccol} package may serve as an |
| 104 |
% example application; it uses the rounding facilities of this package. |
| 105 |
% |
| 106 |
% \section{User interface} |
| 107 |
% The user commands are divided into two categories: |
| 108 |
% the normal and the register commands. Each command |
| 109 |
% is available in those two variants, as decribed below. |
| 110 |
% At first, we have to agree about the syntax for floating |
| 111 |
% point numbers. |
| 112 |
% |
| 113 |
% \subsection{Syntax of floating point numbers} |
| 114 |
% In the syntax descriptions below, \meta{fp number} |
| 115 |
% will be used to denote a number according to the following |
| 116 |
% syntax. |
| 117 |
% \begin{flushleft} |
| 118 |
% $\mbox{\meta{fp number}}:=\mbox{\meta{opt signs}} |
| 119 |
% \mbox{\meta{opt digits}}\mbox{\meta{opt dot}} |
| 120 |
% \mbox{\meta{opt digits}}$ |
| 121 |
% \end{flushleft} |
| 122 |
% \meta{opt signs} may be any number of `"+"' and/or `"-"' |
| 123 |
% characters, where each `"-"' toggles the sign of |
| 124 |
% the number. \meta{opt digits} may be any number |
| 125 |
% of characters `"0"'\dots `"9"', and \meta{opt dot} |
| 126 |
% is the optional decimal sign. For example, the |
| 127 |
% following inputs for \meta{fp number} are valid, |
| 128 |
% resulting into the specified numbers. |
| 129 |
% \fpexample{100}, \fpexample{010,98700}, \fpexample{-,99}, |
| 130 |
% \fpexample{-+-+0001,}, \fpexample{}, \fpexample{---,50}. |
| 131 |
% As you can see, leading and trailing zeros are removed |
| 132 |
% as far as possible, and an `empty number' (omitting anything |
| 133 |
% optional) is understood as zero. |
| 134 |
% |
| 135 |
% There is no syntax checking, so if you do not obey the |
| 136 |
% rules above, you are likely to encounter strange error |
| 137 |
% messages, as well as everything might work properly in |
| 138 |
% some cases. |
| 139 |
% Of course, it is also possible to |
| 140 |
% use a macro as \meta{fp number} if it expands to a |
| 141 |
% string satisfying the syntax rules. |
| 142 |
% |
| 143 |
% \subsection{Standard operations} |
| 144 |
% \DescribeMacro\fpAdd\DescribeMacro\fpSub |
| 145 |
% \DescribeMacro\fpMul\DescribeMacro\fpDiv |
| 146 |
% The standard commands for binary operations have the following |
| 147 |
% common syntax: |
| 148 |
% \begin{flushleft} |
| 149 |
% "\fp"\meta{bOp}"{"\meta{command sequence}"}{"\meta{fp number}"}"^^A |
| 150 |
% "{"\meta{fp number}"}". |
| 151 |
% \end{flushleft} |
| 152 |
% This will perform the operation specified by \meta{bOp} |
| 153 |
% with the two given numbers, saving the result in |
| 154 |
% \meta{command sequence}. Possibilities for |
| 155 |
% \meta{bOp} are `"Add"', `"Sub"', `"Mul"' and `"Div"', |
| 156 |
% specifying addition, subtraction, multiplication, |
| 157 |
% and division. Example: |
| 158 |
% \begin{flushleft} |
| 159 |
% "\fpAdd{\exmplsum}{100,0}{-99,1}"\\ |
| 160 |
% "\fpMul{\exmplprod}{5}{\exmplsum}" |
| 161 |
% \end{flushleft} |
| 162 |
% \fpAdd{\exmplsum}{100,0}{-99,1}^^A |
| 163 |
% \fpMul{\exmplprod}{5}{\exmplsum}^^A |
| 164 |
% After this, the results of the computations will |
| 165 |
% be stored in the macros "\exmplsum" and "\exmplprod", |
| 166 |
% expanding to \exmplsum\ and \exmplprod. |
| 167 |
% |
| 168 |
% \DescribeMacro\fpNeg\DescribeMacro\fpAbs |
| 169 |
% Similar to the binary operations, the unary operations |
| 170 |
% share the common syntax |
| 171 |
% \begin{flushleft} |
| 172 |
% "\fp"\meta{uOp}"{"\meta{command sequence}"}{"\meta{fp number}"}". |
| 173 |
% \end{flushleft} |
| 174 |
% Possibilities for \meta{uOp} are `"Abs"' and `"Neg"', |
| 175 |
% meaning absolute amount and negation. |
| 176 |
% |
| 177 |
% \DescribeMacro\fpRound |
| 178 |
% With "\fpRound{"\meta{command sequence}"}{"\meta{fp number}^^A |
| 179 |
% "}{"\meta{precision}"}", |
| 180 |
% a number can be rounded to the desired precision (a power of ten). |
| 181 |
% The result |
| 182 |
% is saved in \meta{command sequence} as usual. |
| 183 |
% |
| 184 |
% \subsection{Register operations} |
| 185 |
% You may use register variants of all operations, |
| 186 |
% which means that you perform the operation on |
| 187 |
% a register which contains a number. A register is |
| 188 |
% referred to using its name; the name may |
| 189 |
% contain any characters including digits. |
| 190 |
% |
| 191 |
% \DescribeMacro\fpRegSet\DescribeMacro\fpRegGet |
| 192 |
% Registers are initialized by assigning them values, |
| 193 |
% using "\fpRegSet". They can be read out into |
| 194 |
% command sequences using "\fpRegGet". |
| 195 |
% \begin{flushleft} |
| 196 |
% "\fpRegSet{"\meta{reg name}"}{"\meta{fp number}"}"\\ |
| 197 |
% "\fpRegGet{"\meta{reg name}"}{"\meta{command sequence}"}" |
| 198 |
% \end{flushleft} |
| 199 |
% |
| 200 |
% \DescribeMacro\fpRegAdd\DescribeMacro\fpRegSub |
| 201 |
% \DescribeMacro\fpRegMul\DescribeMacro\fpRegDiv |
| 202 |
% The binary operations need two register names. |
| 203 |
% After execution, the first register will hold |
| 204 |
% the result of the specified computation, |
| 205 |
% performed with its former value and the |
| 206 |
% value of the second register. |
| 207 |
% \begin{flushleft} |
| 208 |
% "\fp"\meta{bOp}"{"\meta{reg name 1}"}{"\meta{reg name 2}"}" |
| 209 |
% \end{flushleft} |
| 210 |
% \DescribeMacro\fpRegAbs\DescribeMacro\fpRegNeg |
| 211 |
% Consequently, the unary operations only need |
| 212 |
% the name of the register. |
| 213 |
% \begin{flushleft} |
| 214 |
% "\fp"\meta{uOp}"{"\meta{reg name}"}" |
| 215 |
% \end{flushleft} |
| 216 |
% \DescribeMacro\fpRegRound |
| 217 |
% Rounding of registers is also possible. |
| 218 |
% \begin{flushleft} |
| 219 |
% "\fpRegRound{"\meta{reg name}"}{"\meta{precision}"}" |
| 220 |
% \end{flushleft} |
| 221 |
% \DescribeMacro\fpRegCopy |
| 222 |
% Furthermore, there is one binary operation only available for |
| 223 |
% registers, this is "\fpRegCopy" which assigns the |
| 224 |
% value of \meta{reg name 2} to register \meta{reg name 1}. |
| 225 |
% |
| 226 |
% For example, consider the following statements. |
| 227 |
% \begin{flushleft} |
| 228 |
% "\fpRegSet{test1}{36} \fpRegSet{test2}{-3}"\\ |
| 229 |
% "\fpRegDiv{test1}{test2} \fpRegMul{test1}{test1}"\\ |
| 230 |
% "\fpRegGet{test1}{\fpresult}" |
| 231 |
% \end{flushleft} |
| 232 |
% \fpRegSet{test1}{36}\fpRegSet{test2}{-3}^^A |
| 233 |
% \fpRegDiv{test1}{test2}\fpRegMul{test1}{test1}^^A |
| 234 |
% \fpRegGet{test1}{\fpresult}^^A |
| 235 |
% After this, "test1" will hold the value \fpresult, which |
| 236 |
% "\fpresult" will expand to. |
| 237 |
% |
| 238 |
% |
| 239 |
% \subsection{Configuration and Parameters} |
| 240 |
% |
| 241 |
% \DescribeMacro\fpAccuracy |
| 242 |
% The macro "\fpAccuracy" takes one argument (a number), |
| 243 |
% determining the number of digits after the decimal sign, |
| 244 |
% i.\,e., the accuracy of the computations. |
| 245 |
% The default value is five. |
| 246 |
% At the moment, the name promises too much. |
| 247 |
% The command only affects "\fpDiv" and "\fpRegDiv". |
| 248 |
% |
| 249 |
% \DescribeMacro\fpDecimalSign |
| 250 |
% With "\fpDecimalSign{"\meta{character}"}" you can chose any character |
| 251 |
% for use as the decimal sign. Normally, this will be either |
| 252 |
% a point or a comma; the default is a comma. |
| 253 |
% You can furthermore use the package options |
| 254 |
% \texttt{comma} or \texttt{point}. |
| 255 |
% The support for options like \texttt{english} or \texttt{german} |
| 256 |
% has been removed. It will not be added again, and there will be no |
| 257 |
% detection of packages like \texttt{babel} or \texttt{german}. |
| 258 |
% In my view, a comma is the better choice regardless of the language |
| 259 |
% in question (and it is the \textsc{iso} standard). On the other hand, |
| 260 |
% many people think that a point should be used even in German texts. |
| 261 |
% So, you have to make an explicit decision. |
| 262 |
% |
| 263 |
% \section{Final Remarks} |
| 264 |
% After the first release, I intended to include the features listed |
| 265 |
% below in the near future. |
| 266 |
% Unfortunately, I didn't have time to do so, and maybe I will |
| 267 |
% never have, since I am currently not interested in extending this |
| 268 |
% package. If I continued the development some day, the |
| 269 |
% first extensions might be what is listed here. |
| 270 |
% \begin{itemize} |
| 271 |
% \item Extend syntax to support numbers like $1,7\mathrm{E}{-}1$ or |
| 272 |
% $2,765\cdot 10^5$ in input and output. |
| 273 |
% \item Formatted, customizable output. |
| 274 |
% \item User access to the comparison of registers. |
| 275 |
% \item A better concept for chosing the accuracy of the computations. |
| 276 |
% \item More operations like $\mathrm{e}^x$, $\sqrt{x}$, $\sin x$, |
| 277 |
% $\ln x$\ldots |
| 278 |
% \end{itemize} |
| 279 |
% |
| 280 |
% Some users have pointed out that the terminus \lq floating-point\rq\ |
| 281 |
% is not strictly correct for what is provided by the package. Alas! I |
| 282 |
% happily stick to the package name. |
| 283 |
% |
| 284 |
% If you encounter needs not satisfied by this package, you may |
| 285 |
% wait for the unlikely event of an extension from my part, or you can |
| 286 |
% have a look at the following packages and see if they do what you want: |
| 287 |
% \begin{itemize} |
| 288 |
% \item {\tt fp} by Michael Mehlich for calculations, |
| 289 |
% \item {\tt numprint} by Harald Harders for formatted printing of |
| 290 |
% numbers. |
| 291 |
% \end{itemize} |
| 292 |
% Finally, the license of this package is LPPL, so feel free to do |
| 293 |
% it yourself. |
| 294 |
% |
| 295 |
% \StopEventually{% |
| 296 |
% \ifmulticols |
| 297 |
% \addtocontents{toc}{\protect\end{multicols}} |
| 298 |
% \fi} |
| 299 |
% \section{Implementation} |
| 300 |
% |
| 301 |
% \subsection{General ideas} |
| 302 |
% The main idea was to represent numbers internally by storing their |
| 303 |
% digits in an array/record-like construction (to be referred to as |
| 304 |
% an array or as a register from now on) whose numbering |
| 305 |
% reflects the decimal position factor of the digit, with |
| 306 |
% some information about the range of the numbering |
| 307 |
% and the sign of the number. |
| 308 |
% An array consists of a couple of command sequences, |
| 309 |
% sharing a common name followed by an element number. |
| 310 |
% E.\,g., `$120.3$' means $1\cdot 10^2+2\cdot 10^1+ |
| 311 |
% 0\cdot 10^0+3\cdot 10^{-1}$. So, if the number is to be stored |
| 312 |
% in the array "\exmpl", the command sequences |
| 313 |
% "\exmpl@2", "\exmpl@1", "\exmpl@0" and "\exmpl@-1" |
| 314 |
% will be defined as `"1"', `"2"', `"0"' and `"3"', respectively. |
| 315 |
% The sign information `"+"' will be stored in "\exmpl@sig". |
| 316 |
% "\exmpl@ul" (`upper limit') will be `"2"', "\exmpl@ll" (`lower |
| 317 |
% limit') will be `"-1"'. |
| 318 |
% |
| 319 |
% The computations are performed as |
| 320 |
% you do it with paper and pencil. |
| 321 |
% E.\,g., for an addition, all corresponding digits |
| 322 |
% are summed, taking over anything |
| 323 |
% exceeding ten to the next pair of digits. |
| 324 |
% Thus, there is no limit to the range of numbers or to the |
| 325 |
% number of digits after the decimal sign, except |
| 326 |
% \TeX's memory and, probably the limiting factor, your patience. |
| 327 |
% |
| 328 |
% Initially, the computations were not performed inside of |
| 329 |
% groups, and side-effects were avoided using more |
| 330 |
% counters and constructions like "\xloop" etc. |
| 331 |
% This may make more efficient use of \TeX, as far as speed |
| 332 |
% and save stack usage is concerned, but I think that further |
| 333 |
% extensions will be much simpler now without the |
| 334 |
% need to worry about possible side-effects and the surprising |
| 335 |
% result when, once again, something happens you simply |
| 336 |
% did not think of. Furthermore, this provides |
| 337 |
% a simple mechanism of removing temporary stuff |
| 338 |
% from the memory. |
| 339 |
% |
| 340 |
% But now, let's reveal the code\dots |
| 341 |
% |
| 342 |
% |
| 343 |
% \subsection{Driver file} |
| 344 |
% The driver file can be generated from \texttt{fltpoint.dtx} |
| 345 |
% and then be used to produce the documentation (if you don't like |
| 346 |
% to run \LaTeX\ directly over the \texttt{dtx}-file). |
| 347 |
% \begin{macrocode} |
| 348 |
%<*deccomma> |
| 349 |
\mathchardef\CommaOrdinary="013B |
| 350 |
\mathchardef\CommaPunct ="613B |
| 351 |
\mathcode`,="8000 |
| 352 |
{\catcode`\,=\active |
| 353 |
\gdef ,{\obeyspaces\futurelet\next\CommaCheck}} |
| 354 |
\def\CommaCheck{\if\space\next\CommaPunct\else\CommaOrdinary\fi} |
| 355 |
%</deccomma> |
| 356 |
%<*driver> |
| 357 |
\documentclass{ltxdoc} |
| 358 |
\usepackage{deccomma,fltpoint} |
| 359 |
%\OnlyDescription |
| 360 |
\AlsoImplementation |
| 361 |
\EnableCrossrefs % disable if index is ready |
| 362 |
\CodelineIndex |
| 363 |
\RecordChanges |
| 364 |
%\DisableCrossrefs |
| 365 |
\newcommand{\fpexample}[1]{% |
| 366 |
\fpRegSet{fptemp}{#1}% |
| 367 |
\fpRegGet{fptemp}{\fptemp}% |
| 368 |
$\mbox{\tt`#1'}\rightarrow\fptemp$} |
| 369 |
\begin{document} |
| 370 |
\DocInput{fltpoint.dtx} |
| 371 |
\end{document} |
| 372 |
%</driver> |
| 373 |
% \end{macrocode} |
| 374 |
% |
| 375 |
% |
| 376 |
% \subsection{\LaTeX\ package definitions} |
| 377 |
% If used as a \LaTeX\ package, the usual \LaTeX\ preliminaries |
| 378 |
% and some option declarations are necessary. |
| 379 |
% \begin{macrocode} |
| 380 |
%<*package> |
| 381 |
\NeedsTeXFormat{LaTeX2e} |
| 382 |
\ProvidesPackage{fltpoint}[2004/11/12 v1.1b floating point arithmetic] |
| 383 |
\DeclareOption{comma}{\AtBeginDocument{\fpDecimalSign,}} |
| 384 |
\DeclareOption{point}{\AtBeginDocument{\fpDecimalSign.}} |
| 385 |
\ProcessOptions*\relax |
| 386 |
\input{fltpoint} |
| 387 |
%</package> |
| 388 |
% \end{macrocode} |
| 389 |
% |
| 390 |
% \iffalse |
| 391 |
%<*fltmain> |
| 392 |
% \fi |
| 393 |
% \subsection{Private letters} |
| 394 |
% |
| 395 |
% \begin{macro}{\atcatcode} |
| 396 |
% `"@"' is used for private command sequences. Its catcode is saved |
| 397 |
% in "\atcatcode" to be restored just before "\endinput". |
| 398 |
% \begin{macrocode} |
| 399 |
\edef\atcatcode{\the\catcode`\@} |
| 400 |
\catcode`\@=11 |
| 401 |
% \end{macrocode} |
| 402 |
% \end{macro} |
| 403 |
% |
| 404 |
% |
| 405 |
% \subsection{\LaTeX\ or not?} |
| 406 |
% |
| 407 |
% Check for \LaTeX, otherwise provide the "\@ifnextchar" mechanism |
| 408 |
% copied from the \LaTeX\ source, see there for explanation. |
| 409 |
% \begin{macrocode} |
| 410 |
\ifx\documentclass\relax |
| 411 |
\long\def\@ifnextchar#1#2#3{% |
| 412 |
\let\reserved@d=#1% |
| 413 |
\def\reserved@a{#2}% |
| 414 |
\def\reserved@b{#3}% |
| 415 |
\futurelet\@let@token\@ifnch} |
| 416 |
\def\@ifnch{% |
| 417 |
\ifx\@let@token\@sptoken |
| 418 |
\let\reserved@c\@xifnch |
| 419 |
\else |
| 420 |
\ifx\@let@token\reserved@d |
| 421 |
\let\reserved@c\reserved@a |
| 422 |
\else |
| 423 |
\let\reserved@c\reserved@b |
| 424 |
\fi |
| 425 |
\fi |
| 426 |
\reserved@c} |
| 427 |
\def\:{\let\@sptoken= } \: |
| 428 |
\def\:{\@xifnch} \expandafter\def\: {\futurelet\@let@token\@ifnch} |
| 429 |
\fi |
| 430 |
% \end{macrocode} |
| 431 |
% \subsection{Additional loop structures} |
| 432 |
% |
| 433 |
% \begin{macro}{\iloop} |
| 434 |
% \begin{macro}{\xloop} |
| 435 |
% To be able to nest loop structures without the need for |
| 436 |
% hiding the inner loop(s) in grouped blocks, the constructions |
| 437 |
% "\iloop...\irepeat" and "\xloop...\xrepeat" are defined |
| 438 |
% analogously to \PlainTeX's "\loop...\repeat". |
| 439 |
% "\iloop" will be used `internally' by macros which are |
| 440 |
% to be used in ordinary "\loop"s or in "\xloop"s. |
| 441 |
% "\xloop" will be used |
| 442 |
% `externally', surrounding ordinary "\loop"s. |
| 443 |
% \begin{macrocode} |
| 444 |
\def\iloop#1\irepeat{\def\ibody{#1}\iiterate} |
| 445 |
\def\iiterate{\ibody\let\inext=\iiterate\else\let\inext=\relax\fi |
| 446 |
\inext} |
| 447 |
\def\xloop#1\xrepeat{\def\xbody{#1}\xiterate} |
| 448 |
\def\xiterate{\xbody\let\xnext\xiterate\else\let\xnext\relax\fi\xnext} |
| 449 |
% \end{macrocode} |
| 450 |
% The following assignments are necessary to make |
| 451 |
% "\loop"\dots"\if"\dots"\repeat" |
| 452 |
% constructions skippable inside another "\if". |
| 453 |
% \begin{macrocode} |
| 454 |
\let\repeat\fi |
| 455 |
\let\irepeat\fi |
| 456 |
\let\xrepeat\fi |
| 457 |
% \end{macrocode} |
| 458 |
% \end{macro} |
| 459 |
% \end{macro} |
| 460 |
% |
| 461 |
% |
| 462 |
% \subsection{Allocation of registers} |
| 463 |
% |
| 464 |
% \begin{macro}{\fp@loopcount} |
| 465 |
% \begin{macro}{\fp@loopcountii} |
| 466 |
% \begin{macro}{\fp@result} |
| 467 |
% \begin{macro}{\fp@carryover} |
| 468 |
% \begin{macro}{\fp@tempcount} |
| 469 |
% \begin{macro}{\fp@tempcountii} |
| 470 |
% Several count registers are needed. I have tried to keep this |
| 471 |
% number small, which means that, at some points, I may have chosen a |
| 472 |
% less logical or less readable usage of counts. |
| 473 |
% Nevertheless, I do not claim to have minimized the number |
| 474 |
% as far as possible\dots |
| 475 |
% |
| 476 |
% "\fp@loopcount" and "\fp@loopcountii" are often, but not always, used |
| 477 |
% for "\loop"s, "\fp@loopcountii" sometimes just stores the finishing |
| 478 |
% number. "\fp@result" and "\fp@carryover" |
| 479 |
% are used to store the intermediate results of computations. |
| 480 |
% "\fp@tempcount" and "\fp@tempcountii" are scratch registers |
| 481 |
% whose values should not be considered to be the same |
| 482 |
% after the use of any macro, except the simple array |
| 483 |
% accession abbreviations starting whith "\ar@", as explained below. |
| 484 |
% \begin{macrocode} |
| 485 |
\newcount\fp@loopcount |
| 486 |
\newcount\fp@loopcountii |
| 487 |
\newcount\fp@result |
| 488 |
\newcount\fp@carryover |
| 489 |
\newcount\fp@tempcount |
| 490 |
\newcount\fp@tempcountii |
| 491 |
% \end{macrocode} |
| 492 |
% \end{macro} |
| 493 |
% \end{macro} |
| 494 |
% \end{macro} |
| 495 |
% \end{macro} |
| 496 |
% \end{macro} |
| 497 |
% \end{macro} |
| 498 |
% |
| 499 |
% \subsection{Communication between macros and groups} |
| 500 |
% |
| 501 |
% \begin{macro}{\fp@setparam} |
| 502 |
% \begin{macro}{\fp@param} |
| 503 |
% To pass information from one macro to another, or from |
| 504 |
% inside a group to the outer world, the construction |
| 505 |
% "\fp@setparam{"\meta{information}"}" is used. It saves |
| 506 |
% \meta{information} globally in the command sequence "\fp@param". |
| 507 |
% This mechanism is used, e.\,g., by "\fp@regcomp", |
| 508 |
% "\fp@getdigit" to pass their result to the calling macro, |
| 509 |
% or by "\fp@regadd" etc.\ to make \meta{information} survive the end |
| 510 |
% of the current group. Since "\xdef" is used, \meta{information} |
| 511 |
% will be fully expanded. |
| 512 |
% \begin{macrocode} |
| 513 |
\def\fp@setparam#1{\xdef\fp@param{#1}}% |
| 514 |
% \end{macrocode} |
| 515 |
% \end{macro} |
| 516 |
% \end{macro} |
| 517 |
% |
| 518 |
% \subsection{Array accession} |
| 519 |
% |
| 520 |
% \begin{macro}{\ar@set} |
| 521 |
% \begin{macro}{\ar@get} |
| 522 |
% \begin{macro}{\ar@setsig} |
| 523 |
% \begin{macro}{\ar@getsig} |
| 524 |
% \begin{macro}{\ar@setul} |
| 525 |
% \begin{macro}{\ar@getul} |
| 526 |
% \begin{macro}{\ar@setll} |
| 527 |
% \begin{macro}{\ar@getll} |
| 528 |
% The idea of arrays using command sequences like |
| 529 |
% "\exmpl@-1" means typing a lot of unreadable |
| 530 |
% "\expandafter"s and "\csname"s, so the following |
| 531 |
% abbreviations were introduced. They take the base name of |
| 532 |
% the array as the first argument, if needed followed by |
| 533 |
% an element number, for the "set"-commands followed by |
| 534 |
% the third argument to be the (new) value. |
| 535 |
% No checks are performed if the element number |
| 536 |
% is inside the boundaries of the array, nor anything |
| 537 |
% else to ensure the validity of the operation. |
| 538 |
% |
| 539 |
% "\ar@set" is used to save digits. |
| 540 |
% "\ar@setsig", "\ar@setul" and "\ar@setll" set sign, |
| 541 |
% upper and lower limit of the array. |
| 542 |
% "\ar@get", "\ar@getsig", "\ar@getul" and "\ar@getll" |
| 543 |
% are used to access the respective command sequences. |
| 544 |
% \begin{macrocode} |
| 545 |
\def\ar@set#1#2#3{\expandafter\edef\csname#1@\number#2\endcsname{% |
| 546 |
\number#3}} |
| 547 |
\def\ar@get#1#2{\csname#1@\number#2\endcsname} |
| 548 |
\def\ar@setsig#1#2{\expandafter\edef\csname#1@sig\endcsname{#2}} |
| 549 |
\def\ar@getsig#1{\csname#1@sig\endcsname} |
| 550 |
\def\ar@getul#1{\csname#1@ul\endcsname} |
| 551 |
\def\ar@getll#1{\csname#1@ll\endcsname} |
| 552 |
\def\ar@setul#1#2{\expandafter\edef\csname#1@ul\endcsname{\number#2}} |
| 553 |
\def\ar@setll#1#2{\expandafter\edef\csname#1@ll\endcsname{\number#2}} |
| 554 |
% \end{macrocode} |
| 555 |
% \end{macro} |
| 556 |
% \end{macro} |
| 557 |
% \end{macro} |
| 558 |
% \end{macro} |
| 559 |
% \end{macro} |
| 560 |
% \end{macro} |
| 561 |
% \end{macro} |
| 562 |
% \end{macro} |
| 563 |
% |
| 564 |
% \subsection{Miscellaneous} |
| 565 |
% |
| 566 |
% \begin{macro}{\fp@settomax} |
| 567 |
% The macro "\fp@settomax" assigns the maximum of the two |
| 568 |
% numbers given as "#2" and "#3" to the counter "#1". |
| 569 |
% \begin{macrocode} |
| 570 |
\def\fp@settomax#1#2#3{% |
| 571 |
\ifnum#2<#3\relax |
| 572 |
#1=#3\relax |
| 573 |
\else |
| 574 |
#1=#2\relax |
| 575 |
\fi |
| 576 |
} |
| 577 |
% \end{macrocode} |
| 578 |
% \end{macro} |
| 579 |
% |
| 580 |
% \begin{macro}{\fp@settomin} |
| 581 |
% The macro "\fp@settomin" does the same with the minimum. |
| 582 |
% \begin{macrocode} |
| 583 |
\def\fp@settomin#1#2#3{% |
| 584 |
\ifnum#2<#3\relax |
| 585 |
#1=#2\relax |
| 586 |
\else |
| 587 |
#1=#3\relax |
| 588 |
\fi |
| 589 |
} |
| 590 |
% \end{macrocode} |
| 591 |
% \end{macro} |
| 592 |
% |
| 593 |
% \begin{macro}{\fp@modulo} |
| 594 |
% The macro "\fp@modulo" computes the result of $\mbox{\#1}\bmod |
| 595 |
% \mbox{\#2}$ and saves it in "\fp@param". |
| 596 |
% \begin{macrocode} |
| 597 |
\def\fp@modulo#1#2{% |
| 598 |
\fp@tempcount=#1\relax |
| 599 |
\fp@tempcountii=#1\relax |
| 600 |
\divide\fp@tempcountii#2\relax |
| 601 |
\multiply\fp@tempcountii#2\relax |
| 602 |
\advance\fp@tempcount-\fp@tempcountii |
| 603 |
\edef\fp@param{\number\fp@tempcount}} |
| 604 |
% \end{macrocode} |
| 605 |
% \end{macro} |
| 606 |
% |
| 607 |
% |
| 608 |
% \subsection{Setting and getting register contents} |
| 609 |
% |
| 610 |
% \begin{macro}{\fp@regread} |
| 611 |
% \begin{macro}{\fp@regread@raw} |
| 612 |
% The macro "\fp@regread" reads the string or command sequence |
| 613 |
% (after expansion) given as "#2" into register "#1". |
| 614 |
% The main work is done by the subroutine |
| 615 |
% "\fp@readchars", where "\fp@tempcount" is used to indicate |
| 616 |
% the current position. "\fp@arrayname" is used to pass |
| 617 |
% "#1" to "\fp@readchars". |
| 618 |
% \begin{macrocode} |
| 619 |
\def\fp@regread#1#2{% |
| 620 |
\fp@regread@raw{#1}{#2}% |
| 621 |
\fp@cleanreg{#1}} |
| 622 |
\def\fp@regread@raw#1#2{% |
| 623 |
% \end{macrocode} |
| 624 |
% Initialize "\fp@tempcount". |
| 625 |
% Initialize "\fp@arrayname". |
| 626 |
% Make "#1" positive by default. |
| 627 |
% \begin{macrocode} |
| 628 |
\fp@tempcount=0 |
| 629 |
\edef\fp@arrayname{#1}% |
| 630 |
\ar@setsig{#1}{+}% |
| 631 |
% \end{macrocode} |
| 632 |
% Now call "\fp@readchars" with "#2" fully expanded, |
| 633 |
% followed by a decimal sign. The decimal sign is necessary because |
| 634 |
% "\fp@readchars" expects at least one decimal sign to occur in the |
| 635 |
% given string, so if "#2" is, say, "100", this will make it |
| 636 |
% readable. On the other hand, a superficial decimal sign at the end |
| 637 |
% of a number like $1.34$ will be ignored. |
| 638 |
% \begin{macrocode} |
| 639 |
\edef\fp@scratch{#2\fp@decimalsign}% |
| 640 |
\expandafter\fp@readchars\fp@scratch\end |
| 641 |
% \end{macrocode} |
| 642 |
% If the first character of "#2" has been a decimal sign, the upper |
| 643 |
% limit will be wrong, no pre-point digits will be present. |
| 644 |
% This does not conform the internal syntax and is |
| 645 |
% corrected now. |
| 646 |
% \begin{macrocode} |
| 647 |
\ifnum\ar@getul{#1}=-1 |
| 648 |
\ar@setul{#1}{0}% |
| 649 |
\ar@set{#1}{0}{0}% |
| 650 |
\fi |
| 651 |
% \end{macrocode} |
| 652 |
% The $n$ digits before the decimal sign (if any) have been |
| 653 |
% read in from left to right, assigning positions from |
| 654 |
% $0\ldots n$, so they have to be swapped to |
| 655 |
% their correct positions. This is done with two counters, |
| 656 |
% one starting as $0$, the other as $n$, using |
| 657 |
% "\fp@scratch" for temporary storage. |
| 658 |
% \begin{macrocode} |
| 659 |
\fp@tempcount=0 |
| 660 |
\fp@tempcountii=\ar@getul{#1}\relax |
| 661 |
\iloop |
| 662 |
\ifnum\fp@tempcount<\fp@tempcountii |
| 663 |
\edef\fp@scratch{\ar@get{#1}{\fp@tempcountii}}% |
| 664 |
\ar@set{#1}{\fp@tempcountii}{\ar@get{#1}{\fp@tempcount}}% |
| 665 |
\ar@set{#1}{\fp@tempcount}{\fp@scratch}% |
| 666 |
\advance\fp@tempcount by 1 |
| 667 |
\advance\fp@tempcountii by -1 |
| 668 |
\irepeat |
| 669 |
}% end \fp@regread@raw |
| 670 |
% \end{macrocode} |
| 671 |
% \end{macro} |
| 672 |
% \end{macro} |
| 673 |
% |
| 674 |
% \begin{macro}{\fp@readchars} |
| 675 |
% As mentioned above, this subroutine is called by |
| 676 |
% "\fp@regread" to do the actual work of reading |
| 677 |
% the given number character after character into the register |
| 678 |
% passed using "\fp@arrayname". It will stop if it sees |
| 679 |
% an \fbox{\tt end} token. |
| 680 |
% \begin{macrocode} |
| 681 |
\def\fp@readchars#1{% |
| 682 |
\ifx#1\end |
| 683 |
% \end{macrocode} |
| 684 |
% If the condition is true, the token read before has been the final |
| 685 |
% one. So at the end, do not call "\fp@readchars" any more, and use |
| 686 |
% the current value of "\fp@tempcount" to assign the correct |
| 687 |
% lower limit to the register. |
| 688 |
% \begin{macrocode} |
| 689 |
\let\inext=\relax |
| 690 |
\ifnum\fp@tempcount<0 |
| 691 |
\advance\fp@tempcount by 1 |
| 692 |
\ar@setll{\fp@arrayname}{\fp@tempcount}% |
| 693 |
\else |
| 694 |
\ar@setll{\fp@arrayname}{0}% |
| 695 |
\fi |
| 696 |
\else % \ifx#1\end |
| 697 |
% \end{macrocode} |
| 698 |
% If the condition is false, further characters will |
| 699 |
% follow, so "\fp@readchars" will have to be called |
| 700 |
% again after finishing this character. |
| 701 |
% \begin{macrocode} |
| 702 |
\let\inext=\fp@readchars |
| 703 |
% \end{macrocode} |
| 704 |
% Now check the character and perform the respective actions. |
| 705 |
% \begin{macrocode} |
| 706 |
\ifx#1+% |
| 707 |
% \end{macrocode} |
| 708 |
% An optional `"+"' has been encountered, nothing to do. |
| 709 |
% \begin{macrocode} |
| 710 |
\else |
| 711 |
\ifx#1-% |
| 712 |
% \end{macrocode} |
| 713 |
% `"-"' sign, toggle sign. |
| 714 |
% \begin{macrocode} |
| 715 |
\if\ar@getsig{\fp@arrayname}-% |
| 716 |
\ar@setsig{\fp@arrayname}{+}% |
| 717 |
\else |
| 718 |
\ar@setsig{\fp@arrayname}{-}% |
| 719 |
\fi |
| 720 |
\else |
| 721 |
\if\noexpand#1\fp@decimalsign% |
| 722 |
% \end{macrocode} |
| 723 |
% A decimal sign has been encountered. So, if it is the first |
| 724 |
% one, switch to reading afterpoint digits, otherwise ignore it. |
| 725 |
% \begin{macrocode} |
| 726 |
\ifnum\fp@tempcount>-1 |
| 727 |
\advance\fp@tempcount by -1 |
| 728 |
\ar@setul{\fp@arrayname}{\fp@tempcount}% |
| 729 |
\fp@tempcount=-1 |
| 730 |
\fi |
| 731 |
\else |
| 732 |
% \end{macrocode} |
| 733 |
% None of the above characters was encountered, so assume |
| 734 |
% a digit, and read it into the current position. Then step |
| 735 |
% "\fp@tempcount" by $+1$ if prepoint digits are read in, |
| 736 |
% or by $-1$ if the decimal sign has already been seen. |
| 737 |
% \begin{macrocode} |
| 738 |
\ar@set{\fp@arrayname}{\fp@tempcount}{#1}% |
| 739 |
\ifnum\fp@tempcount<0 |
| 740 |
\advance\fp@tempcount by -1 |
| 741 |
\else |
| 742 |
\advance\fp@tempcount by 1 |
| 743 |
\fi |
| 744 |
\fi% end \if\noexpand#1\fp@decimalsign |
| 745 |
\fi% end \ifx#1- |
| 746 |
\fi% end \ifx#1+ |
| 747 |
\fi% end \ifx#1\end |
| 748 |
% \end{macrocode} |
| 749 |
% That's all, call "\inext". |
| 750 |
% \begin{macrocode} |
| 751 |
\inext |
| 752 |
}% end \fp@readchars |
| 753 |
% \end{macrocode} |
| 754 |
% \end{macro} |
| 755 |
% |
| 756 |
% \begin{macro}{\fp@regget} |
| 757 |
% The macro "\fp@regget" is used to read the contents of the |
| 758 |
% register "#1" into the command sequence "#2". |
| 759 |
% \begin{macrocode} |
| 760 |
\def\fp@regget#1#2{% |
| 761 |
% \end{macrocode} |
| 762 |
% First, we get the sign of the number. If negative, |
| 763 |
% "#2" is initialized as `"-"', otherwise as empty. |
| 764 |
% \begin{macrocode} |
| 765 |
\if\ar@getsig{#1}-% |
| 766 |
\def#2{-}% |
| 767 |
\else |
| 768 |
\def#2{}% |
| 769 |
\fi |
| 770 |
% \end{macrocode} |
| 771 |
% Then we set up "\fp@tempcount" as the counter for an "\iloop", |
| 772 |
% starting at the upper limit of "#1". |
| 773 |
% \begin{macrocode} |
| 774 |
\fp@tempcount=\ar@getul{#1}\relax |
| 775 |
\iloop |
| 776 |
% \end{macrocode} |
| 777 |
% If the "\fp@tempcount" is $-1$, we have to append a decimal sign. |
| 778 |
% \begin{macrocode} |
| 779 |
\ifnum\fp@tempcount=-1 |
| 780 |
\edef#2{#2\fp@decimalsign}% |
| 781 |
\fi |
| 782 |
% \end{macrocode} |
| 783 |
% Now append the corresponding digit. |
| 784 |
% \begin{macrocode} |
| 785 |
\edef#2{#2\ar@get{#1}{\fp@tempcount}}% |
| 786 |
% \end{macrocode} |
| 787 |
% And repeat if the lower limit of "#1" is not yet reached. |
| 788 |
% \begin{macrocode} |
| 789 |
\ifnum\fp@tempcount>\ar@getll{#1}\relax |
| 790 |
\advance\fp@tempcount by -1 |
| 791 |
\irepeat |
| 792 |
}% end \def\fp@regget |
| 793 |
% \end{macrocode} |
| 794 |
% \end{macro} |
| 795 |
% |
| 796 |
% \begin{macro}{\fp@cleanreg} |
| 797 |
% The macro "\fp@cleanreg" will clean up the given register. |
| 798 |
% This means that leading and trailing zeros will be |
| 799 |
% removed, and that $-0$ will be turned into $+0$ |
| 800 |
% to be recognised as equal later on. |
| 801 |
% \begin{macrocode} |
| 802 |
\def\fp@cleanreg#1{% |
| 803 |
% \end{macrocode} |
| 804 |
% First, we will iterate until all leading zeros |
| 805 |
% have been removed, except for digit $0$ that it is |
| 806 |
% expected to be `"0"' for all numbers $n$ with $-1<n<1$. |
| 807 |
% \begin{macrocode} |
| 808 |
\fp@tempcount=\ar@getul{#1}\relax |
| 809 |
\iloop |
| 810 |
\ifnum\fp@tempcount>0 |
| 811 |
\ifnum\ar@get{#1}{\fp@tempcount}=0 |
| 812 |
% \end{macrocode} |
| 813 |
% If this is true, the first digit is a zero and is `removed' |
| 814 |
% by changing the upper limit. It is not necessary to |
| 815 |
% erase it by setting the array element to "\empty" or something |
| 816 |
% like that, because it will not be looked at any more. |
| 817 |
% \begin{macrocode} |
| 818 |
\advance\fp@tempcount by -1 |
| 819 |
\ar@setul{#1}{\fp@tempcount}% |
| 820 |
\else |
| 821 |
% \end{macrocode} |
| 822 |
% So the condition is false, the first digit is not a zero |
| 823 |
% and the following ones need not to be looked at. |
| 824 |
% \begin{macrocode} |
| 825 |
\fp@tempcount=0 |
| 826 |
\fi |
| 827 |
\irepeat |
| 828 |
% \end{macrocode} |
| 829 |
% Similarly, the trailing zeros are removed. |
| 830 |
% \begin{macrocode} |
| 831 |
\fp@tempcount=\ar@getll{#1}\relax |
| 832 |
\iloop |
| 833 |
\ifnum\fp@tempcount<0 |
| 834 |
\ifnum\ar@get{#1}{\fp@tempcount}=0 |
| 835 |
\advance\fp@tempcount by 1 |
| 836 |
\ar@setll{#1}{\fp@tempcount}% |
| 837 |
\else |
| 838 |
\fp@tempcount=0 |
| 839 |
\fi |
| 840 |
\irepeat |
| 841 |
% \end{macrocode} |
| 842 |
% Now check if the number is zero, using |
| 843 |
% $(\mbox{x@ll}=\mbox{x@ul})\wedge(\mbox{x@0}=0)\Longleftrightarrow |
| 844 |
% \rm x=0$, and set the sign to `"+"' if this is the case. |
| 845 |
% \begin{macrocode} |
| 846 |
\ifnum\ar@getll{#1}=\ar@getul{#1}\relax |
| 847 |
\ifnum\ar@get{#1}{0}=0\relax |
| 848 |
\ar@setsig{#1}{+}% |
| 849 |
\fi |
| 850 |
\fi |
| 851 |
}% end \fp@regclean |
| 852 |
% \end{macrocode} |
| 853 |
% \end{macro} |
| 854 |
% |
| 855 |
% \begin{macro}{\fp@getdigit} |
| 856 |
% The macro "\fp@getdigit" will return the digit number "#2" of |
| 857 |
% register "#1" using "\fp@setparam". If "#2" is outside the |
| 858 |
% boundaries of the array, `"0"' is returned. (Which is not only |
| 859 |
% sensible, but also mathematically correct.) |
| 860 |
% \begin{macrocode} |
| 861 |
\def\fp@getdigit#1#2{% |
| 862 |
\ifnum#2<\ar@getll{#1}\relax |
| 863 |
\fp@setparam0% |
| 864 |
\else |
| 865 |
\ifnum#2>\ar@getul{#1}\relax |
| 866 |
\fp@setparam0% |
| 867 |
\else |
| 868 |
\fp@setparam{\ar@get{#1}{#2}}% |
| 869 |
\fi |
| 870 |
\fi |
| 871 |
}% end \fp@getdigit |
| 872 |
% \end{macrocode} |
| 873 |
% \end{macro} |
| 874 |
% |
| 875 |
% \begin{macro}{\fp@shiftright} |
| 876 |
% The macro "\fp@shiftright" takes register "#1" and shifts the decimal |
| 877 |
% sign "#2" digits to the right ("#2" may be negative or zero, too, |
| 878 |
% so there is no need for a "\fp@shiftleft"). |
| 879 |
% The digits are read into "\fp@shiftnum", inserting the decimal |
| 880 |
% sign at the new place. Then, "\fp@shiftnum" is read |
| 881 |
% into "#1" via "\fp@regread". |
| 882 |
% \begin{macrocode} |
| 883 |
\def\fp@shiftright#1#2{% |
| 884 |
% \end{macrocode} |
| 885 |
% First, save the value of "#2" in "\fp@shiftamount". |
| 886 |
% This makes it possible to say, e.\,g., |
| 887 |
% "\fpshiftright{exmpl}{\fp@tempcount}" without side-effects. |
| 888 |
% \begin{macrocode} |
| 889 |
\edef\fp@shiftamount{\number#2}% |
| 890 |
% \end{macrocode} |
| 891 |
% Now, determine the start position. |
| 892 |
% The maximum of the upper limit and "-\fp@shiftamount" is used |
| 893 |
% in order to allow the decimal sign of, e.\,g., |
| 894 |
% $1.1$ to be shifted $-5$ digits to the right. |
| 895 |
% \begin{macrocode} |
| 896 |
\fp@settomax{\fp@tempcount}{\ar@getul{#1}}{-\fp@shiftamount}% |
| 897 |
% \end{macrocode} |
| 898 |
% Similarly, determine the stop position. |
| 899 |
% \begin{macrocode} |
| 900 |
\fp@settomin{\fp@tempcountii}{\ar@getll{#1}}{-\fp@shiftamount}% |
| 901 |
% \end{macrocode} |
| 902 |
% Now, initialize "\fp@shiftnum" and begin the "\iloop". |
| 903 |
% Read digit after digit using "\fp@getdigit", therefore |
| 904 |
% getting a `"0"' outside the boundaries. Insert the |
| 905 |
% decimal sign at the new position given by |
| 906 |
% "-\fp@shiftamount". |
| 907 |
% \begin{macrocode} |
| 908 |
\def\fp@shiftnum{}% |
| 909 |
\iloop |
| 910 |
\fp@getdigit{#1}{\fp@tempcount}% |
| 911 |
\edef\fp@shiftnum{\fp@shiftnum\fp@param}% |
| 912 |
\ifnum\fp@tempcount=-\fp@shiftamount\relax |
| 913 |
\edef\fp@shiftnum{\fp@shiftnum\fp@decimalsign}% |
| 914 |
\fi |
| 915 |
\ifnum\fp@tempcount>\fp@tempcountii |
| 916 |
\advance\fp@tempcount by -1 |
| 917 |
\irepeat |
| 918 |
% \end{macrocode} |
| 919 |
% Finally, assign the value to "#1". |
| 920 |
% \begin{macrocode} |
| 921 |
\fp@regread{#1}{\fp@shiftnum}% |
| 922 |
}% end \fp@shiftright |
| 923 |
% \end{macrocode} |
| 924 |
% \end{macro} |
| 925 |
% |
| 926 |
% \begin{macro}{\fp@firstnonzero} |
| 927 |
% The macro "\fp@firstnonzero" returns the first non-zero |
| 928 |
% digit of register "#1" via "\fp@setparam". |
| 929 |
% \begin{macrocode} |
| 930 |
\def\fp@firstnonzero#1{% |
| 931 |
% \end{macrocode} |
| 932 |
% If "#1" is zero, the "\iloop" below will run infinitely, |
| 933 |
% so this case has to be checked separately by comparing |
| 934 |
% "#1" to the internal register "@0" which holds zero. |
| 935 |
% `"0"' is returned if "#1" is zero. |
| 936 |
% \begin{macrocode} |
| 937 |
\fp@regcomp{#1}{@0}% |
| 938 |
\if\fp@param=% |
| 939 |
\fp@setparam0% |
| 940 |
% \end{macrocode} |
| 941 |
% Otherwise, each digit is checked, starting at the upper limit, |
| 942 |
% and the position of first digit differing from zero is |
| 943 |
% returned in "\fp@param". |
| 944 |
% \begin{macrocode} |
| 945 |
\else |
| 946 |
\fp@tempcount=\ar@getul{#1}\relax% |
| 947 |
\fp@tempcountii=\ar@getll{#1}\relax% |
| 948 |
\iloop |
| 949 |
\ifnum\ar@get{#1}{\fp@tempcount}>0 |
| 950 |
\fp@setparam{\number\fp@tempcount}% |
| 951 |
\fp@tempcount=\fp@tempcountii |
| 952 |
\fi |
| 953 |
\ifnum\fp@tempcount>\fp@tempcountii |
| 954 |
\advance\fp@tempcount by -1 |
| 955 |
\irepeat |
| 956 |
\fi |
| 957 |
}% end \fp@firstnonzero |
| 958 |
% \end{macrocode} |
| 959 |
% \end{macro} |
| 960 |
% |
| 961 |
% |
| 962 |
% \subsection{Comparison of registers} |
| 963 |
% |
| 964 |
% \begin{macro}{\fp@regcomp} |
| 965 |
% The macro "\fp@regcomp" compares the two specified registers. |
| 966 |
% It saves the result of the comparison (either `"<"', `">"', |
| 967 |
% or `"="') in "\fp@param". First, it checks whether the |
| 968 |
% two numbers have the same sign or not. If not, |
| 969 |
% the comparison is very easy, otherwise "\fp@regcomp@main" |
| 970 |
% is called to do the work. |
| 971 |
% \begin{macrocode} |
| 972 |
\def\fp@regcomp#1#2{% |
| 973 |
{% |
| 974 |
\if\ar@getsig{#1}-% |
| 975 |
\if\ar@getsig{#2}-% |
| 976 |
\fp@regcomp@main{#1}{#2}<>% |
| 977 |
\else |
| 978 |
\fp@setparam{<}% |
| 979 |
\fi |
| 980 |
\else |
| 981 |
\if\ar@getsig{#2}-% |
| 982 |
\fp@setparam{>}% |
| 983 |
\else |
| 984 |
\fp@regcomp@main{#1}{#2}><% |
| 985 |
\fi |
| 986 |
\fi |
| 987 |
}% |
| 988 |
} |
| 989 |
% \end{macrocode} |
| 990 |
% \end{macro} |
| 991 |
% |
| 992 |
% \begin{macro}{\fp@regcomp@main} |
| 993 |
% The macro "\fp@regcomp@main" takes four parameters: |
| 994 |
% The two registers to be compared, and two tokens |
| 995 |
% to be used as result. This is needed because |
| 996 |
% if, e.\,g., two numbers have the same sign and |
| 997 |
% are equal for all positions greater than |
| 998 |
% $10^2$, and number~1 has `"9"' at position $10^2$ and number~2 |
| 999 |
% has `"5"', then the result must be `"<"' if $n_1<n_2<0$, |
| 1000 |
% but `">"' if $n_1>n_2>0$. |
| 1001 |
% |
| 1002 |
% First, the range of digits to compare is determined. |
| 1003 |
% Then, each pair of digits is compared. If different, |
| 1004 |
% "\fp@param" is set and the loop is terminated by |
| 1005 |
% setting the loop counter to the stop position. |
| 1006 |
% If the digits are equal and there are no more digits |
| 1007 |
% to compare, the numbers are equal. |
| 1008 |
% \begin{macrocode} |
| 1009 |
\def\fp@regcomp@main#1#2#3#4{% |
| 1010 |
\fp@settomax{\fp@loopcount}{\ar@getul{#1}}{\ar@getul{#2}}% |
| 1011 |
\fp@settomin{\fp@loopcountii}{\ar@getll{#1}}{\ar@getll{#2}}% |
| 1012 |
\loop |
| 1013 |
\fp@getdigit{#1}{\fp@loopcount}% |
| 1014 |
\fp@tempcount=\fp@param\relax |
| 1015 |
\fp@getdigit{#2}{\fp@loopcount}% |
| 1016 |
\fp@tempcountii=\fp@param\relax |
| 1017 |
\ifnum\fp@tempcount<\fp@tempcountii |
| 1018 |
\fp@setparam{#4}% |
| 1019 |
\fp@loopcount=\fp@loopcountii |
| 1020 |
\else |
| 1021 |
\ifnum\fp@tempcount>\fp@tempcountii |
| 1022 |
\fp@setparam{#3}% |
| 1023 |
\fp@loopcount=\fp@loopcountii |
| 1024 |
\else |
| 1025 |
\ifnum\fp@loopcount=\fp@loopcountii |
| 1026 |
\fp@setparam{=}% |
| 1027 |
\fi |
| 1028 |
\fi |
| 1029 |
\fi |
| 1030 |
\ifnum\fp@loopcount>\fp@loopcountii |
| 1031 |
\advance\fp@loopcount by -1 |
| 1032 |
\repeat |
| 1033 |
}% end \fp@regcomp@main |
| 1034 |
% \end{macrocode} |
| 1035 |
% \end{macro} |
| 1036 |
% |
| 1037 |
% |
| 1038 |
% \subsection{Unary Operations} |
| 1039 |
% |
| 1040 |
% \begin{macro}{\fp@regabs} |
| 1041 |
% The macro "\fp@regabs" turns register "#1" into its amount. |
| 1042 |
% This is rather trivial: just set the sign to `"+"'. |
| 1043 |
% \begin{macrocode} |
| 1044 |
\def\fp@regabs#1{% |
| 1045 |
\ar@setsig{#1}{+}% |
| 1046 |
} |
| 1047 |
% \end{macrocode} |
| 1048 |
% \end{macro} |
| 1049 |
% |
| 1050 |
% \begin{macro}{\fp@regneg} |
| 1051 |
% The macro "\fp@regneg" negates register "#1". It checks |
| 1052 |
% whether the actual sign is `"+"' or `"-"' and sets it |
| 1053 |
% to its opposite, except that nothing is done if the |
| 1054 |
% number is zero. |
| 1055 |
% \begin{macrocode} |
| 1056 |
\def\fp@regneg#1{% |
| 1057 |
\if\ar@getsig{#1}-% |
| 1058 |
\ar@setsig{#1}{+}% |
| 1059 |
\else |
| 1060 |
\fp@regcomp{#1}{@0}% |
| 1061 |
\if\fp@param=% |
| 1062 |
\else |
| 1063 |
\ar@setsig{#1}{-}% |
| 1064 |
\fi |
| 1065 |
\fi |
| 1066 |
} |
| 1067 |
% \end{macrocode} |
| 1068 |
% \end{macro} |
| 1069 |
% |
| 1070 |
% \begin{macro}{\fp@reground} |
| 1071 |
% The macro "\fp@reground" rounds register "#1" with a target accuracy |
| 1072 |
% given as "#2" (as a power of ten). |
| 1073 |
% \begin{macrocode} |
| 1074 |
\def\fp@reground#1#2{% |
| 1075 |
% \end{macrocode} |
| 1076 |
% Fist, if the desired accuracy is smaller than the lower limit of |
| 1077 |
% "#1", nothing has to be done. |
| 1078 |
% \begin{macrocode} |
| 1079 |
\ifnum#2>\ar@getll{#1}\relax |
| 1080 |
{% |
| 1081 |
% \end{macrocode} |
| 1082 |
% Otherwise, we check the following digit. If it is greater than four, |
| 1083 |
% we have to advance digit "#2" before truncating the number. This |
| 1084 |
% means adding $10^{\mathtt{\#2}}$ for positive "#1" and subtracting |
| 1085 |
% $10^{\mathtt{\#2}}$ for negative "#1". |
| 1086 |
% \begin{macrocode} |
| 1087 |
\fp@tempcount=#2\relax |
| 1088 |
\advance\fp@tempcount by -1 |
| 1089 |
\fp@getdigit{#1}{\fp@tempcount}% |
| 1090 |
\ifnum\fp@param>4 |
| 1091 |
\fp@regcopy{fp@temp}{@1}% |
| 1092 |
\fp@shiftright{fp@temp}{#2}% |
| 1093 |
\fp@regcomp{#1}{@0}% |
| 1094 |
\if\fp@param<% |
| 1095 |
\fp@regneg{fp@temp}% |
| 1096 |
\fi |
| 1097 |
\fp@regadd{#1}{fp@temp}% |
| 1098 |
\fi |
| 1099 |
% \end{macrocode} |
| 1100 |
% Afterwards, we set the lower limit to "#2". If "#2" is greater than |
| 1101 |
% zero, |
| 1102 |
% we set the lower limit and all digits~$n$ with $0\leq n<\texttt{\#2}$ |
| 1103 |
% to zero. Then we read the number using |
| 1104 |
% "\fp@regget", make it globally available and read it into "#1" |
| 1105 |
% after finishing the local group. |
| 1106 |
% \begin{macrocode} |
| 1107 |
\ifnum#2>0 |
| 1108 |
\fp@loopcount=#2\relax |
| 1109 |
\iloop |
| 1110 |
\ifnum\fp@loopcount>0 |
| 1111 |
\advance\fp@loopcount by -1 |
| 1112 |
\ar@set{#1}{\fp@loopcount}{0}% |
| 1113 |
\irepeat |
| 1114 |
\ar@setll{#1}{0}% |
| 1115 |
\else |
| 1116 |
\ar@setll{#1}{#2}% |
| 1117 |
\fi |
| 1118 |
\fp@regget{#1}{\fp@scratch}% |
| 1119 |
\fp@setparam\fp@scratch |
| 1120 |
}% |
| 1121 |
\fp@regread{#1}{\fp@param}% |
| 1122 |
\fi |
| 1123 |
} % end \fp@reground |
| 1124 |
% \end{macrocode} |
| 1125 |
% \end{macro} |
| 1126 |
% |
| 1127 |
% |
| 1128 |
% \subsection{Binary operations} |
| 1129 |
% |
| 1130 |
% \begin{macro}{\fp@regcopy} |
| 1131 |
% The macro "\fp@regcopy" assigns the value of register |
| 1132 |
% "#2" to register "#1". This is done simply by reading |
| 1133 |
% register "#2" into a scratch control sequence |
| 1134 |
% and then reading this into register "#1". |
| 1135 |
% \begin{macrocode} |
| 1136 |
\def\fp@regcopy#1#2{% |
| 1137 |
\fp@regget{#2}{\fp@scratch}% |
| 1138 |
\fp@regread{#1}{\fp@scratch}% |
| 1139 |
} |
| 1140 |
% \end{macrocode} |
| 1141 |
% \end{macro} |
| 1142 |
% |
| 1143 |
% \begin{macro}{\fp@regadd} |
| 1144 |
% The macro "\fp@regadd" adds the value of register "#2" to |
| 1145 |
% register "#1". |
| 1146 |
% \begin{macrocode} |
| 1147 |
\def\fp@regadd#1#2{% |
| 1148 |
{% |
| 1149 |
% \end{macrocode} |
| 1150 |
% First, check whether the two numbers have the same sign. |
| 1151 |
% \begin{macrocode} |
| 1152 |
\if\ar@getsig{#1}\ar@getsig{#2}% |
| 1153 |
% \end{macrocode} |
| 1154 |
% If the two numbers have the same sign, the addition can be |
| 1155 |
% done by adding each two corresponding digits and a possible |
| 1156 |
% carryover, starting at $\min(\mbox{ll1},\mbox{ll2})$, |
| 1157 |
% ending at $\max(\mbox{ul1},\mbox{ul2})$. Those values |
| 1158 |
% are saved in "\fp@add@start" and "\fp@add@finish". |
| 1159 |
% \begin{macrocode} |
| 1160 |
\fp@settomin{\fp@loopcount}{\ar@getll{#1}}{\ar@getll{#2}}% |
| 1161 |
\edef\fp@add@start{\number\fp@loopcount}% |
| 1162 |
\fp@settomax{\fp@tempcount}{\ar@getul{#1}}{\ar@getul{#2}}% |
| 1163 |
\edef\fp@add@finish{\number\fp@tempcount}% |
| 1164 |
% \end{macrocode} |
| 1165 |
% Initialize "\fp@carryover". |
| 1166 |
% \begin{macrocode} |
| 1167 |
\fp@carryover=0 |
| 1168 |
% \end{macrocode} |
| 1169 |
% Now start the main loop. Each digit is computed |
| 1170 |
% in counter "\fp@result" as the |
| 1171 |
% sum of the corresponding digits plus the carryover from |
| 1172 |
% the previous pair. If the sum is greater than 10, |
| 1173 |
% it is reduced by 10 and "\fp@carryover" is set to 1. |
| 1174 |
% (No sum greater than 19 is possible.) |
| 1175 |
% \begin{macrocode} |
| 1176 |
\loop |
| 1177 |
\fp@getdigit{#1}{\fp@loopcount}% |
| 1178 |
\fp@result=\fp@param\relax |
| 1179 |
\fp@getdigit{#2}{\fp@loopcount}% |
| 1180 |
\advance\fp@result by \fp@param\relax |
| 1181 |
\advance\fp@result by \fp@carryover |
| 1182 |
\ifnum\fp@result>9 |
| 1183 |
\fp@carryover=1 |
| 1184 |
\advance\fp@result by -10 |
| 1185 |
\else |
| 1186 |
\fp@carryover=0 |
| 1187 |
\fi |
| 1188 |
\ar@set{#1}{\fp@loopcount}{\fp@result}% |
| 1189 |
\ifnum\fp@loopcount<\fp@add@finish\relax |
| 1190 |
\advance\fp@loopcount by 1 |
| 1191 |
\repeat |
| 1192 |
% \end{macrocode} |
| 1193 |
% If the last pair had a carryover, take it into account. |
| 1194 |
% Then adjust the lower and upper limit of the result. |
| 1195 |
% \begin{macrocode} |
| 1196 |
\ifnum\fp@carryover>0 |
| 1197 |
\advance\fp@loopcount by 1 |
| 1198 |
\ar@set{#1}{\fp@loopcount}{\fp@carryover}% |
| 1199 |
\fi |
| 1200 |
\ar@setll{#1}{\fp@add@start}% |
| 1201 |
\ar@setul{#1}{\fp@loopcount}% |
| 1202 |
% \end{macrocode} |
| 1203 |
% Finally, save the result in "\fp@param" to make it survive |
| 1204 |
% the endgroup character after "\fi". |
| 1205 |
% \begin{macrocode} |
| 1206 |
\fp@regget{#1}{\fp@scratch}% |
| 1207 |
\fp@setparam\fp@scratch |
| 1208 |
% \end{macrocode} |
| 1209 |
% That's it. But if the two numbers have different signs, |
| 1210 |
% the situation is a bit more complicated. In this case, |
| 1211 |
% the amounts of "#1" and "#2" are saved in two temporary registers |
| 1212 |
% ("fp@tempi" and "fp@tempii"). The smaller one is subtracted |
| 1213 |
% from the larger one, and the sign of the result is |
| 1214 |
% adjusted according to the sign of "#1" and "#2". |
| 1215 |
% This is done by the subroutine "\fp@regadd@sub", which also takes |
| 1216 |
% care of saving the result in "\fp@param". |
| 1217 |
% \begin{macrocode} |
| 1218 |
\else % \if sign |
| 1219 |
\fp@regcopy{fp@tempi}{#1}% |
| 1220 |
\fp@regcopy{fp@tempii}{#2}% |
| 1221 |
\fp@regabs{fp@tempi}% |
| 1222 |
\fp@regabs{fp@tempii}% |
| 1223 |
\fp@regcomp{fp@tempi}{fp@tempii}% |
| 1224 |
\if\fp@param>% |
| 1225 |
\fp@regadd@sub{#1}{fp@tempi}{fp@tempii}% |
| 1226 |
\else |
| 1227 |
\fp@regadd@sub{#2}{fp@tempii}{fp@tempi}% |
| 1228 |
\fi |
| 1229 |
\fi % end \if sign |
| 1230 |
% \end{macrocode} |
| 1231 |
% Now end the group to keep everything local, and read |
| 1232 |
% the result in "\fp@param" into register "#1". |
| 1233 |
% \begin{macrocode} |
| 1234 |
}% |
| 1235 |
\fp@regread{#1}{\fp@param}% |
| 1236 |
}% end \fp@regadd |
| 1237 |
% \end{macrocode} |
| 1238 |
% \end{macro} |
| 1239 |
% |
| 1240 |
% \begin{macro}{\fp@regadd@sub} |
| 1241 |
% The macro "\fp@regadd@sub" is a subroutine of |
| 1242 |
% "\fp@regadd". |
| 1243 |
% \begin{macrocode} |
| 1244 |
\def\fp@regadd@sub#1#2#3{% |
| 1245 |
% \end{macrocode} |
| 1246 |
% First, subtract "#3" from "#2". The restriction $\mbox{\tt\#2}> |
| 1247 |
% \mbox{\tt\#3}$ is ensured by the calling "\fp@regadd". |
| 1248 |
% \begin{macrocode} |
| 1249 |
\fp@regsub@restricted{#2}{#3}% |
| 1250 |
% \end{macrocode} |
| 1251 |
% "#1" is the original number of which "#2" is the amount. |
| 1252 |
% So, if it is negative, the final result also has to be negative. |
| 1253 |
% This is done by the following four lines. |
| 1254 |
% \begin{macrocode} |
| 1255 |
\fp@regcomp{#1}{@0}% |
| 1256 |
\if\fp@param<% |
| 1257 |
\fp@regneg{#2}% |
| 1258 |
\fi |
| 1259 |
% \end{macrocode} |
| 1260 |
% Now, the final result is stored in "#2". Make it |
| 1261 |
% globally available using "\fp@setparam". |
| 1262 |
% \begin{macrocode} |
| 1263 |
\fp@regget{#2}{\fp@scratch}% |
| 1264 |
\fp@setparam\fp@scratch |
| 1265 |
}% end \fp@regadd@sub |
| 1266 |
% \end{macrocode} |
| 1267 |
% \end{macro} |
| 1268 |
% |
| 1269 |
% \begin{macro}{\fp@regsub@restricted} |
| 1270 |
% The macro "\fp@regsub@restricted" does the actual |
| 1271 |
% work of subtracting "#2" from "#1", provided that |
| 1272 |
% "#1" is greater than "#2". It is called by |
| 1273 |
% "\fp@regadd@sub" and by "\fp@regdiv". |
| 1274 |
% \begin{macrocode} |
| 1275 |
\def\fp@regsub@restricted#1#2{% |
| 1276 |
% \end{macrocode} |
| 1277 |
% First, we start a group to keep counters etc.\ local. |
| 1278 |
% Then, we determine the start and end position for the |
| 1279 |
% loop, as above for "\fp@regadd". |
| 1280 |
% \begin{macrocode} |
| 1281 |
{% |
| 1282 |
\fp@settomin{\fp@loopcount}{\ar@getll{#1}}{\ar@getll{#2}}% |
| 1283 |
\edef\fp@lowermin{\number\fp@loopcount}% |
| 1284 |
\fp@settomax{\fp@tempcount}{\ar@getul{#1}}{\ar@getul{#2}}% |
| 1285 |
\edef\fp@uppermin{\number\fp@tempcount}% |
| 1286 |
% \end{macrocode} |
| 1287 |
% Now subtract the corresponding digits, taking into |
| 1288 |
% account a possible carryover. |
| 1289 |
% \begin{macrocode} |
| 1290 |
\fp@carryover=0 |
| 1291 |
\loop |
| 1292 |
\fp@getdigit{#1}{\fp@loopcount}% |
| 1293 |
\fp@result=\fp@param\relax |
| 1294 |
\fp@getdigit{#2}{\fp@loopcount}% |
| 1295 |
\advance\fp@result by -\fp@param\relax |
| 1296 |
\advance\fp@result by \fp@carryover |
| 1297 |
% \end{macrocode} |
| 1298 |
% If the result is $<0$, add 10 to the result |
| 1299 |
% and set the carryover to $-1$. |
| 1300 |
% \begin{macrocode} |
| 1301 |
\ifnum\fp@result<0 |
| 1302 |
\fp@carryover=-1 |
| 1303 |
\advance\fp@result by 10 |
| 1304 |
\else |
| 1305 |
\fp@carryover=0 |
| 1306 |
\fi |
| 1307 |
% \end{macrocode} |
| 1308 |
% Now save the result and repeat if there are further |
| 1309 |
% digits. |
| 1310 |
% \begin{macrocode} |
| 1311 |
\ar@set{#1}{\fp@loopcount}{\fp@result}% |
| 1312 |
\ifnum\fp@loopcount<\fp@uppermin\relax |
| 1313 |
\advance\fp@loopcount by 1 |
| 1314 |
\repeat |
| 1315 |
% \end{macrocode} |
| 1316 |
% If there is a carryover for the last two digits, |
| 1317 |
% take it into account. |
| 1318 |
% \begin{macrocode} |
| 1319 |
\ifnum\fp@carryover=-1 |
| 1320 |
\advance\fp@loopcount by 1 |
| 1321 |
\ar@set{#1}{\fp@loopcount}{-1}% |
| 1322 |
\fi |
| 1323 |
% \end{macrocode} |
| 1324 |
% Now adjust the upper and lower limit of the result, |
| 1325 |
% and save it in "\fp@param". |
| 1326 |
% \begin{macrocode} |
| 1327 |
\ar@setll{#1}{\fp@lowermin}% |
| 1328 |
\ar@setul{#1}{\fp@loopcount}% |
| 1329 |
\fp@regget{#1}{\fp@scratch}% |
| 1330 |
\fp@setparam\fp@scratch |
| 1331 |
}% |
| 1332 |
% \end{macrocode} |
| 1333 |
% Finally, assign the result to "#1" inside the current group. |
| 1334 |
% \begin{macrocode} |
| 1335 |
\fp@regread{#1}{\fp@param}% |
| 1336 |
}% end \fp@regsub@restricted |
| 1337 |
% \end{macrocode} |
| 1338 |
% \end{macro} |
| 1339 |
% \begin{macro}{\fp@regsub} |
| 1340 |
% The macro "\fp@regsub" subtracts register "#2" from |
| 1341 |
% register "#1". This is done by negating "#2" inside |
| 1342 |
% a group and calling "\fp@regadd". |
| 1343 |
% \begin{macrocode} |
| 1344 |
\def\fp@regsub#1#2{% |
| 1345 |
{% |
| 1346 |
\fp@regneg{#2}% |
| 1347 |
\fp@regadd{#1}{#2}% |
| 1348 |
\fp@regget{#1}{\fp@scratch}% |
| 1349 |
\fp@setparam\fp@scratch |
| 1350 |
}% |
| 1351 |
\fp@regread{#1}{\fp@param}% |
| 1352 |
} |
| 1353 |
% \end{macrocode} |
| 1354 |
% \end{macro} |
| 1355 |
% |
| 1356 |
% \begin{macro}{\fp@regmul} |
| 1357 |
% The macro "\fp@regmul" multiplies the value |
| 1358 |
% of register "#1" with the value of register "#2". |
| 1359 |
% \begin{macrocode} |
| 1360 |
\def\fp@regmul#1#2{% |
| 1361 |
{% |
| 1362 |
% \end{macrocode} |
| 1363 |
% First, we initialize the temporary register "fp@temp1" |
| 1364 |
% as zero; it will be used to hold the results so far. |
| 1365 |
% Then we start the outer "\xloop" which will |
| 1366 |
% run through all digits of "#2", beginning at the lower limit. |
| 1367 |
% \begin{macrocode} |
| 1368 |
\fp@regcopy{fp@temp1}{@0}% |
| 1369 |
\fp@loopcountii=\ar@getll{#2}\relax |
| 1370 |
\xloop |
| 1371 |
% \end{macrocode} |
| 1372 |
% Then we initialize the inner loop, which multplies the |
| 1373 |
% current digit of "#2" with "#1" digit after digit, |
| 1374 |
% saving the result in "\fp@newnum". |
| 1375 |
% \begin{macrocode} |
| 1376 |
\fp@loopcount=\ar@getll{#1}\relax |
| 1377 |
\fp@carryover=0 |
| 1378 |
\def\fp@newnum{}% |
| 1379 |
\loop |
| 1380 |
\fp@result=\ar@get{#2}{\fp@loopcountii}\relax |
| 1381 |
\multiply\fp@result by \ar@get{#1}{\fp@loopcount}\relax |
| 1382 |
\advance\fp@result by \fp@carryover |
| 1383 |
% \end{macrocode} |
| 1384 |
% If the result is greater than~9, we set the carryover |
| 1385 |
% as $(\mbox{\tt\bslash fp@result}\bmod 10)$ and |
| 1386 |
% the result to $(\mbox{\tt\bslash fp@result}\mathop{\mbox{div}}10)$. |
| 1387 |
% \begin{macrocode} |
| 1388 |
\ifnum\fp@result>9 |
| 1389 |
\fp@carryover=\fp@result |
| 1390 |
\divide\fp@carryover by 10 |
| 1391 |
\fp@tempcount=\fp@carryover |
| 1392 |
\multiply\fp@tempcount by 10 |
| 1393 |
\advance\fp@result by -\fp@tempcount |
| 1394 |
\else |
| 1395 |
\fp@carryover=0 |
| 1396 |
\fi |
| 1397 |
\edef\fp@newnum{\number\fp@result\fp@newnum}% |
| 1398 |
\ifnum\fp@loopcount<\ar@getul{#1}\relax |
| 1399 |
\advance\fp@loopcount by 1 |
| 1400 |
\repeat |
| 1401 |
\edef\fp@newnum{\number\fp@carryover\fp@newnum}% |
| 1402 |
\fp@regread{fp@temp2}{\fp@newnum}% |
| 1403 |
% \end{macrocode} |
| 1404 |
% Now "fp@temp2" holds the partial result for this digit of |
| 1405 |
% "#2". We have to multiply it with $10^n$, if $n$ is the |
| 1406 |
% number of digits of "#2" completed so far. |
| 1407 |
% This is done by calling "\fp@shiftright" with $-n$ as |
| 1408 |
% second argument. |
| 1409 |
% \begin{macrocode} |
| 1410 |
\fp@tempcount=\fp@loopcountii |
| 1411 |
\advance\fp@tempcount by -\number\ar@getll{#2}\relax |
| 1412 |
\fp@shiftright{fp@temp2}{\fp@tempcount}% |
| 1413 |
% \end{macrocode} |
| 1414 |
% Now we add "fp@temp2" to the results so far and iterate |
| 1415 |
% if there are further digits. |
| 1416 |
% \begin{macrocode} |
| 1417 |
\fp@regadd{fp@temp1}{fp@temp2}% |
| 1418 |
\ifnum\fp@loopcountii<\ar@getul{#2}\relax |
| 1419 |
\advance\fp@loopcountii by 1 |
| 1420 |
\xrepeat |
| 1421 |
% \end{macrocode} |
| 1422 |
% The final result of the multiplication will have |
| 1423 |
% as much afterpoint digits as "#1" and "#2" have together. |
| 1424 |
% Adjust this. |
| 1425 |
% \begin{macrocode} |
| 1426 |
\fp@tempcount=\ar@getll{#1}\relax |
| 1427 |
\advance\fp@tempcount by \ar@getll{#2}\relax |
| 1428 |
\fp@shiftright{fp@temp1}{\fp@tempcount}% |
| 1429 |
% \end{macrocode} |
| 1430 |
% If "#1" and "#2" have different signs, the result is negative, |
| 1431 |
% otherwise positive. |
| 1432 |
% \begin{macrocode} |
| 1433 |
\if\ar@getsig{#1}\ar@getsig{#2}% |
| 1434 |
\else |
| 1435 |
\fp@regneg{fp@temp1}% |
| 1436 |
\fi |
| 1437 |
% \end{macrocode} |
| 1438 |
% Finally, save the result via "\fp@setparam" and assign it |
| 1439 |
% to "#1" after the end of the group. |
| 1440 |
% \begin{macrocode} |
| 1441 |
\fp@regget{fp@temp1}{\fp@scratch}% |
| 1442 |
\fp@setparam\fp@scratch |
| 1443 |
}% |
| 1444 |
\fp@regread{#1}{\fp@param}% |
| 1445 |
} % end \fp@regmul |
| 1446 |
% \end{macrocode} |
| 1447 |
% \end{macro} |
| 1448 |
% |
| 1449 |
% \begin{macro}{\fp@regdiv} |
| 1450 |
% The macro "\fp@regdiv" divides register "#1" by register "#2". |
| 1451 |
% It works by repeated subtraction. |
| 1452 |
% \begin{macrocode} |
| 1453 |
\def\fp@regdiv#1#2{% |
| 1454 |
{% |
| 1455 |
% \end{macrocode} |
| 1456 |
% The amount of the two numbers is read into the two |
| 1457 |
% temporary registers "fp@temp1" and "fp@temp2". |
| 1458 |
% \begin{macrocode} |
| 1459 |
\fp@regcopy{fp@temp1}{#1}% |
| 1460 |
\fp@regcopy{fp@temp2}{#2}% |
| 1461 |
\fp@regabs{fp@temp1}% |
| 1462 |
\fp@regabs{fp@temp2}% |
| 1463 |
% \end{macrocode} |
| 1464 |
% First, we determine the initial shift for "fp@temp2". |
| 1465 |
% This is the shift which will make "fp@temp2" have as many |
| 1466 |
% digits before the decimal sign as "fp@temp1". |
| 1467 |
% "\fp@firstnonzero" is used, because the upper limit |
| 1468 |
% need not be the first non-zero digit. |
| 1469 |
% \begin{macrocode} |
| 1470 |
\fp@firstnonzero{fp@temp1}% |
| 1471 |
\fp@loopcountii=\fp@param\relax |
| 1472 |
\fp@firstnonzero{fp@temp2}% |
| 1473 |
\advance\fp@loopcountii by -\fp@param\relax |
| 1474 |
\fp@shiftright{fp@temp2}{\fp@loopcountii}% |
| 1475 |
% \end{macrocode} |
| 1476 |
% Now we initialize "\fp@divnum" which will hold the result. |
| 1477 |
% If "\fp@loopcountii" is smaller than zero, i.\,e., if |
| 1478 |
% the first digit of the result that will be computed |
| 1479 |
% is after the decimal sign, we have to |
| 1480 |
% initialize "\fp@divnum" with the decimal sign as well |
| 1481 |
% as with an appropriate number of zeros following it. |
| 1482 |
% \begin{macrocode} |
| 1483 |
\def\fp@divnum{}% |
| 1484 |
\ifnum\fp@loopcountii<0 |
| 1485 |
\fp@tempcount=\fp@loopcountii |
| 1486 |
\loop |
| 1487 |
\ifnum\fp@tempcount<-1 |
| 1488 |
\edef\fp@divnum{0\fp@divnum}% |
| 1489 |
\advance\fp@tempcount by 1 |
| 1490 |
\repeat |
| 1491 |
\edef\fp@divnum{\fp@decimalsign\fp@divnum}% |
| 1492 |
\fi |
| 1493 |
% \end{macrocode} |
| 1494 |
% The main loop follows. Each digit is determined by |
| 1495 |
% subtracting the divisor $n$ times from the dividend until |
| 1496 |
% the result is smaller than the divisor. |
| 1497 |
% This is done only if "\fp@loopcountii" plus one |
| 1498 |
% is greater than "-\fp@accuracy". |
| 1499 |
% If the divisor is equal to the dividend, the division is complete |
| 1500 |
% and the "\xloop" is terminated. Therefore, "\fp@accuracy" is locally |
| 1501 |
% set to `"0"', so that possibly following zeros are computed |
| 1502 |
% until the digit representing $10^0$. |
| 1503 |
% At the end, the divisor is divided |
| 1504 |
% by 10, and the next digit follows. |
| 1505 |
% \begin{macrocode} |
| 1506 |
\xloop |
| 1507 |
\fp@tempcount=\fp@loopcountii |
| 1508 |
\advance\fp@tempcount by 1 |
| 1509 |
\ifnum\fp@tempcount>-\fp@accuracy\relax |
| 1510 |
\fp@loopcount=0 |
| 1511 |
\loop |
| 1512 |
\fp@regcomp{fp@temp2}{fp@temp1}% |
| 1513 |
\if\fp@param=% |
| 1514 |
\def\fp@accuracy{0}% |
| 1515 |
\gdef\fp@param{<}% |
| 1516 |
\fi |
| 1517 |
\if\fp@param<% |
| 1518 |
\fp@regsub@restricted{fp@temp1}{fp@temp2}% |
| 1519 |
\advance\fp@loopcount by 1 |
| 1520 |
\repeat |
| 1521 |
\ifnum\fp@loopcountii=-1 |
| 1522 |
\edef\fp@divnum{\fp@divnum\fp@decimalsign}% |
| 1523 |
\fi |
| 1524 |
\edef\fp@divnum{\fp@divnum\number\fp@loopcount}% |
| 1525 |
\fp@shiftright{fp@temp2}{-1}% |
| 1526 |
\advance\fp@loopcountii by -1 |
| 1527 |
\xrepeat |
| 1528 |
% \end{macrocode} |
| 1529 |
% The sign of the result is set according to the |
| 1530 |
% signs of "#1" and "#2". |
| 1531 |
% \begin{macrocode} |
| 1532 |
\if\ar@getsig{#1}\ar@getsig{#2}% |
| 1533 |
\fp@regread{fp@temp1}{\fp@divnum}% |
| 1534 |
\else |
| 1535 |
\fp@regread{fp@temp1}{-\fp@divnum}% |
| 1536 |
\fi |
| 1537 |
% \end{macrocode} |
| 1538 |
% Now save the result in "\fp@param". After endgroup, |
| 1539 |
% read it into "#1". |
| 1540 |
% \begin{macrocode} |
| 1541 |
\fp@regget{fp@temp1}{\fp@scratch}% |
| 1542 |
\fp@setparam\fp@scratch |
| 1543 |
}% |
| 1544 |
\fp@regread{#1}{\fp@param}% |
| 1545 |
} |
| 1546 |
% \end{macrocode} |
| 1547 |
% \end{macro} |
| 1548 |
% |
| 1549 |
% |
| 1550 |
% \subsection{User interface} |
| 1551 |
% |
| 1552 |
% \begin{macro}{\fp@call@bin} |
| 1553 |
% The macro "\fp@call@bin" is a common calling command |
| 1554 |
% used by the user commands for binary operations. It reads |
| 1555 |
% the values given in "#2" and "#3" into temporary registers, |
| 1556 |
% performs the operation specified in "#4", |
| 1557 |
% and finally assigns the result to the command sequence |
| 1558 |
% given as "#1". |
| 1559 |
% \begin{macrocode} |
| 1560 |
\def\fp@call@bin#1#2#3#4{% |
| 1561 |
{% |
| 1562 |
\fp@regread{fp@user1}{#2}% |
| 1563 |
\fp@regread{fp@user2}{#3}% |
| 1564 |
\csname fp@reg#4\endcsname{fp@user1}{fp@user2}% |
| 1565 |
\fp@regget{fp@user1}{\fp@scratch}% |
| 1566 |
\fp@setparam\fp@scratch |
| 1567 |
}% |
| 1568 |
\edef#1{\fp@param}% |
| 1569 |
} |
| 1570 |
% \end{macrocode} |
| 1571 |
% \end{macro} |
| 1572 |
% |
| 1573 |
% \begin{macro}{\fpAdd} |
| 1574 |
% As described above, the main work is done by "\fp@call@bin", |
| 1575 |
% so this macro reduces to passing the parameters and |
| 1576 |
% specifying the desired operation. |
| 1577 |
% \begin{macrocode} |
| 1578 |
\def\fpAdd#1#2#3{\fp@call@bin{#1}{#2}{#3}{add}} |
| 1579 |
% \end{macrocode} |
| 1580 |
% \end{macro} |
| 1581 |
% |
| 1582 |
% \begin{macro}{\fpSub} |
| 1583 |
% Just like "\fpAdd". |
| 1584 |
% \begin{macrocode} |
| 1585 |
\def\fpSub#1#2#3{\fp@call@bin{#1}{#2}{#3}{sub}} |
| 1586 |
% \end{macrocode} |
| 1587 |
% \end{macro} |
| 1588 |
% |
| 1589 |
% \begin{macro}{\fpMul} |
| 1590 |
% Just like "\fpAdd". |
| 1591 |
% \begin{macrocode} |
| 1592 |
\def\fpMul#1#2#3{\fp@call@bin{#1}{#2}{#3}{mul}} |
| 1593 |
% \end{macrocode} |
| 1594 |
% \end{macro} |
| 1595 |
% |
| 1596 |
% \begin{macro}{\fpDiv} |
| 1597 |
% Just like "\fpAdd". |
| 1598 |
% \begin{macrocode} |
| 1599 |
\def\fpDiv#1#2#3{\fp@call@bin{#1}{#2}{#3}{div}} |
| 1600 |
% \end{macrocode} |
| 1601 |
% \end{macro} |
| 1602 |
% |
| 1603 |
% \begin{macro}{\fp@call@un} |
| 1604 |
% Similarly, the unary operations "\fpAbs" and "\fpNeg" |
| 1605 |
% refer to the common macro "\fp@call@un". |
| 1606 |
% \begin{macrocode} |
| 1607 |
\def\fp@call@un#1#2#3{% |
| 1608 |
{% |
| 1609 |
\fp@regread{fp@user1}{#2}% |
| 1610 |
\csname fp@reg#3\endcsname{fp@user1}% |
| 1611 |
\fp@regget{fp@user1}{\fp@scratch}% |
| 1612 |
\fp@setparam\fp@scratch |
| 1613 |
}% |
| 1614 |
\edef#1{\fp@param}% |
| 1615 |
} |
| 1616 |
% \end{macrocode} |
| 1617 |
% \end{macro} |
| 1618 |
% |
| 1619 |
% \begin{macro}{\fpAbs} |
| 1620 |
% Pass the information and specify the action. |
| 1621 |
% \begin{macrocode} |
| 1622 |
\def\fpAbs#1#2{\fp@call@un{#1}{#2}{abs}} |
| 1623 |
% \end{macrocode} |
| 1624 |
% \end{macro} |
| 1625 |
% |
| 1626 |
% \begin{macro}{\fpNeg} |
| 1627 |
% Just like "\fpAbs". |
| 1628 |
% \begin{macrocode} |
| 1629 |
\def\fpNeg#1#2{\fp@call@un{#1}{#2}{neg}} |
| 1630 |
% \end{macrocode} |
| 1631 |
% \end{macro} |
| 1632 |
% |
| 1633 |
% \begin{macro}{\fpRound} |
| 1634 |
% This macro does not fit into the scheme, so it has to be defined |
| 1635 |
% seperately. |
| 1636 |
% \begin{macrocode} |
| 1637 |
\def\fpRound#1#2#3{% |
| 1638 |
{% |
| 1639 |
\fpRegSet{fp@user1}{#2}% |
| 1640 |
\fpRegRound{fp@user1}{#3}% |
| 1641 |
\fpRegGet{fp@user1}{\fp@scratch}% |
| 1642 |
\fp@setparam\fp@scratch |
| 1643 |
}% |
| 1644 |
\edef#1{\fp@param}% |
| 1645 |
} |
| 1646 |
% \end{macrocode} |
| 1647 |
% \end{macro} |
| 1648 |
% |
| 1649 |
% \begin{macro}{\fpRegSet} |
| 1650 |
% The register operations "\fpRegSet", "\fpRegGet", |
| 1651 |
% "\fpRegAdd", "\fpRegSub", "\fpRegMul", "\fpRegDiv", |
| 1652 |
% "\fpRegAbs", "\fpRegNeg", "\fpRegCopy" and "\fpRegRound" |
| 1653 |
% have the same syntax as the internal variants, so their |
| 1654 |
% definitions reduce to passing the parameters. The register name |
| 1655 |
% is always given as the first parameter. |
| 1656 |
% \begin{macrocode} |
| 1657 |
\def\fpRegSet#1#2{\fp@regread{#1}{#2}} |
| 1658 |
% \end{macrocode} |
| 1659 |
% \end{macro} |
| 1660 |
% |
| 1661 |
% \begin{macro}{\fpRegGet} |
| 1662 |
% As described above. |
| 1663 |
% \begin{macrocode} |
| 1664 |
\def\fpRegGet#1#2{\fp@regget{#1}{#2}} |
| 1665 |
% \end{macrocode} |
| 1666 |
% \end{macro} |
| 1667 |
% |
| 1668 |
% \begin{macro}{\fpRegAdd} |
| 1669 |
% As described above. |
| 1670 |
% \begin{macrocode} |
| 1671 |
\def\fpRegAdd#1#2{\fp@regadd{#1}{#2}} |
| 1672 |
% \end{macrocode} |
| 1673 |
% \end{macro} |
| 1674 |
% |
| 1675 |
% \begin{macro}{\fpRegSub} |
| 1676 |
% As described above. |
| 1677 |
% \begin{macrocode} |
| 1678 |
\def\fpRegSub#1#2{\fp@regsub{#1}{#2}} |
| 1679 |
% \end{macrocode} |
| 1680 |
% \end{macro} |
| 1681 |
% |
| 1682 |
% \begin{macro}{\fpRegMul} |
| 1683 |
% As described above. |
| 1684 |
% \begin{macrocode} |
| 1685 |
\def\fpRegMul#1#2{\fp@regmul{#1}{#2}} |
| 1686 |
% \end{macrocode} |
| 1687 |
% \end{macro} |
| 1688 |
% |
| 1689 |
% \begin{macro}{\fpRegDiv} |
| 1690 |
% As described above. |
| 1691 |
% \begin{macrocode} |
| 1692 |
\def\fpRegDiv#1#2{\fp@regdiv{#1}{#2}} |
| 1693 |
% \end{macrocode} |
| 1694 |
% \end{macro} |
| 1695 |
% |
| 1696 |
% \begin{macro}{\fpRegAbs} |
| 1697 |
% As described above. |
| 1698 |
% \begin{macrocode} |
| 1699 |
\def\fpRegAbs#1{\fp@regabs{#1}} |
| 1700 |
% \end{macrocode} |
| 1701 |
% \end{macro} |
| 1702 |
% |
| 1703 |
% \begin{macro}{\fpRegNeg} |
| 1704 |
% As described above. |
| 1705 |
% \begin{macrocode} |
| 1706 |
\def\fpRegNeg#1{\fp@regneg{#1}} |
| 1707 |
% \end{macrocode} |
| 1708 |
% \end{macro} |
| 1709 |
% |
| 1710 |
% \begin{macro}{\fpRegCopy} |
| 1711 |
% As described above. |
| 1712 |
% \begin{macrocode} |
| 1713 |
\def\fpRegCopy#1#2{\fp@regcopy{#1}{#2}} |
| 1714 |
% \end{macrocode} |
| 1715 |
% \end{macro} |
| 1716 |
% |
| 1717 |
% \begin{macro}{\fpRegRound} |
| 1718 |
% As described above. |
| 1719 |
% \begin{macrocode} |
| 1720 |
\def\fpRegRound#1#2{\fp@reground{#1}{#2}} |
| 1721 |
% \end{macrocode} |
| 1722 |
% \end{macro} |
| 1723 |
% |
| 1724 |
% \begin{macro}{\fpAccuracy} |
| 1725 |
% \begin{macro}{\fp@accuracy} |
| 1726 |
% The user command "\fpAccuracy" "\edef"s the internal |
| 1727 |
% parameter "\fp@accuracy", which stores the maximum |
| 1728 |
% number of digits after the decimal sign, i.\,e., |
| 1729 |
% the minimum for the lower limit of fp numbers. |
| 1730 |
% At the moment, "\fp@accuracy" does not affect the accuracy |
| 1731 |
% of any operation except "\fp@regdiv". In fact, it was |
| 1732 |
% introduced when the definition of a termination condition |
| 1733 |
% for the loop was not possible without an externally given limit. |
| 1734 |
% "\fp@accuracy" is initialized to `"5"' digits after |
| 1735 |
% the decimal sign. |
| 1736 |
% \begin{macrocode} |
| 1737 |
\def\fpAccuracy#1{\edef\fp@accuracy{#1}} |
| 1738 |
\fpAccuracy{5} |
| 1739 |
% \end{macrocode} |
| 1740 |
% \end{macro} |
| 1741 |
% \end{macro} |
| 1742 |
% |
| 1743 |
% \begin{macro}{\fpDecimalSign} |
| 1744 |
% \begin{macro}{\fp@decimalsign} |
| 1745 |
% The command "\fpDecimalSign" allows the user to select any character |
| 1746 |
% for use as the decimal sign. The character is stored in |
| 1747 |
% "\fp@decimalsign". Normally, the decimal sign will be either `"."' or |
| 1748 |
% `","'; a comma is the default. (Take a look at ISO~31-0, part 3.3.2, |
| 1749 |
% if you dislike this.) |
| 1750 |
% \begin{macrocode} |
| 1751 |
\def\fpDecimalSign#1{\edef\fp@decimalsign{#1}} |
| 1752 |
\fpDecimalSign{,} |
| 1753 |
% \end{macrocode} |
| 1754 |
% \end{macro} |
| 1755 |
% \end{macro} |
| 1756 |
% |
| 1757 |
% \begin{macro}{\fpThousandsep} |
| 1758 |
% \begin{macro}{\fp@thousandsep} |
| 1759 |
% Those macros are used to define and store a thousand seperator |
| 1760 |
% used by "\fp@regoutput". By default, there is none. |
| 1761 |
% \begin{macrocode} |
| 1762 |
\def\fpThousandSep#1{\edef\fp@thousandsep{#1}} |
| 1763 |
\fpThousandSep{} |
| 1764 |
% \end{macrocode} |
| 1765 |
% \end{macro} |
| 1766 |
% \end{macro} |
| 1767 |
% |
| 1768 |
% \subsection{Constants} |
| 1769 |
% |
| 1770 |
% \begin{macro}{@0} |
| 1771 |
% \begin{macro}{@1} |
| 1772 |
% The number zero ist stored |
| 1773 |
% in register "@0", the number one in register "@1". |
| 1774 |
% \begin{macrocode} |
| 1775 |
\fp@regread{@0}{0} |
| 1776 |
\fp@regread{@1}{1} |
| 1777 |
% \end{macrocode} |
| 1778 |
% \end{macro} |
| 1779 |
% \end{macro} |
| 1780 |
% |
| 1781 |
% |
| 1782 |
% \subsection{Finish} |
| 1783 |
% Finally, restore the catcode of `"@"' and "\endinput". |
| 1784 |
% \begin{macrocode} |
| 1785 |
\catcode`\@=\atcatcode\relax |
| 1786 |
\endinput |
| 1787 |
%</fltmain> |
| 1788 |
% \end{macrocode} |
| 1789 |
% \Finale |
| 1790 |
% \PrintIndex |
| 1791 |
% \PrintChanges |