| 1 |
%% |
| 2 |
%% This is file `fltpoint.tex', |
| 3 |
%% generated with the docstrip utility. |
| 4 |
%% |
| 5 |
%% The original source files were: |
| 6 |
%% |
| 7 |
%% fltpoint.dtx (with options: `fltmain') |
| 8 |
%% |
| 9 |
%% IMPORTANT NOTICE: |
| 10 |
%% |
| 11 |
%% For the copyright see the source file. |
| 12 |
%% |
| 13 |
%% Any modified versions of this file must be renamed |
| 14 |
%% with new filenames distinct from fltpoint.tex. |
| 15 |
%% |
| 16 |
%% For distribution of the original source see the terms |
| 17 |
%% for copying and modification in the file fltpoint.dtx. |
| 18 |
%% |
| 19 |
%% This generated file may be distributed as long as the |
| 20 |
%% original source files, as listed above, are part of the |
| 21 |
%% same distribution. (The sources need not necessarily be |
| 22 |
%% in the same archive or directory.) |
| 23 |
\edef\atcatcode{\the\catcode`\@} |
| 24 |
\catcode`\@=11 |
| 25 |
\ifx\documentclass\relax |
| 26 |
\long\def\@ifnextchar#1#2#3{% |
| 27 |
\let\reserved@d=#1% |
| 28 |
\def\reserved@a{#2}% |
| 29 |
\def\reserved@b{#3}% |
| 30 |
\futurelet\@let@token\@ifnch} |
| 31 |
\def\@ifnch{% |
| 32 |
\ifx\@let@token\@sptoken |
| 33 |
\let\reserved@c\@xifnch |
| 34 |
\else |
| 35 |
\ifx\@let@token\reserved@d |
| 36 |
\let\reserved@c\reserved@a |
| 37 |
\else |
| 38 |
\let\reserved@c\reserved@b |
| 39 |
\fi |
| 40 |
\fi |
| 41 |
\reserved@c} |
| 42 |
\def\:{\let\@sptoken= } \: |
| 43 |
\def\:{\@xifnch} \expandafter\def\: {\futurelet\@let@token\@ifnch} |
| 44 |
\fi |
| 45 |
\def\iloop#1\irepeat{\def\ibody{#1}\iiterate} |
| 46 |
\def\iiterate{\ibody\let\inext=\iiterate\else\let\inext=\relax\fi |
| 47 |
\inext} |
| 48 |
\def\xloop#1\xrepeat{\def\xbody{#1}\xiterate} |
| 49 |
\def\xiterate{\xbody\let\xnext\xiterate\else\let\xnext\relax\fi\xnext} |
| 50 |
\let\repeat\fi |
| 51 |
\let\irepeat\fi |
| 52 |
\let\xrepeat\fi |
| 53 |
\newcount\fp@loopcount |
| 54 |
\newcount\fp@loopcountii |
| 55 |
\newcount\fp@result |
| 56 |
\newcount\fp@carryover |
| 57 |
\newcount\fp@tempcount |
| 58 |
\newcount\fp@tempcountii |
| 59 |
\def\fp@setparam#1{\xdef\fp@param{#1}}% |
| 60 |
\def\ar@set#1#2#3{\expandafter\edef\csname#1@\number#2\endcsname{% |
| 61 |
\number#3}} |
| 62 |
\def\ar@get#1#2{\csname#1@\number#2\endcsname} |
| 63 |
\def\ar@setsig#1#2{\expandafter\edef\csname#1@sig\endcsname{#2}} |
| 64 |
\def\ar@getsig#1{\csname#1@sig\endcsname} |
| 65 |
\def\ar@getul#1{\csname#1@ul\endcsname} |
| 66 |
\def\ar@getll#1{\csname#1@ll\endcsname} |
| 67 |
\def\ar@setul#1#2{\expandafter\edef\csname#1@ul\endcsname{\number#2}} |
| 68 |
\def\ar@setll#1#2{\expandafter\edef\csname#1@ll\endcsname{\number#2}} |
| 69 |
\def\fp@settomax#1#2#3{% |
| 70 |
\ifnum#2<#3\relax |
| 71 |
#1=#3\relax |
| 72 |
\else |
| 73 |
#1=#2\relax |
| 74 |
\fi |
| 75 |
} |
| 76 |
\def\fp@settomin#1#2#3{% |
| 77 |
\ifnum#2<#3\relax |
| 78 |
#1=#2\relax |
| 79 |
\else |
| 80 |
#1=#3\relax |
| 81 |
\fi |
| 82 |
} |
| 83 |
\def\fp@modulo#1#2{% |
| 84 |
\fp@tempcount=#1\relax |
| 85 |
\fp@tempcountii=#1\relax |
| 86 |
\divide\fp@tempcountii#2\relax |
| 87 |
\multiply\fp@tempcountii#2\relax |
| 88 |
\advance\fp@tempcount-\fp@tempcountii |
| 89 |
\edef\fp@param{\number\fp@tempcount}} |
| 90 |
\def\fp@regread#1#2{% |
| 91 |
\fp@regread@raw{#1}{#2}% |
| 92 |
\fp@cleanreg{#1}} |
| 93 |
\def\fp@regread@raw#1#2{% |
| 94 |
\fp@tempcount=0 |
| 95 |
\edef\fp@arrayname{#1}% |
| 96 |
\ar@setsig{#1}{+}% |
| 97 |
\edef\fp@scratch{#2\fp@decimalsign}% |
| 98 |
\expandafter\fp@readchars\fp@scratch\end |
| 99 |
\ifnum\ar@getul{#1}=-1 |
| 100 |
\ar@setul{#1}{0}% |
| 101 |
\ar@set{#1}{0}{0}% |
| 102 |
\fi |
| 103 |
\fp@tempcount=0 |
| 104 |
\fp@tempcountii=\ar@getul{#1}\relax |
| 105 |
\iloop |
| 106 |
\ifnum\fp@tempcount<\fp@tempcountii |
| 107 |
\edef\fp@scratch{\ar@get{#1}{\fp@tempcountii}}% |
| 108 |
\ar@set{#1}{\fp@tempcountii}{\ar@get{#1}{\fp@tempcount}}% |
| 109 |
\ar@set{#1}{\fp@tempcount}{\fp@scratch}% |
| 110 |
\advance\fp@tempcount by 1 |
| 111 |
\advance\fp@tempcountii by -1 |
| 112 |
\irepeat |
| 113 |
}% end \fp@regread@raw |
| 114 |
\def\fp@readchars#1{% |
| 115 |
\ifx#1\end |
| 116 |
\let\inext=\relax |
| 117 |
\ifnum\fp@tempcount<0 |
| 118 |
\advance\fp@tempcount by 1 |
| 119 |
\ar@setll{\fp@arrayname}{\fp@tempcount}% |
| 120 |
\else |
| 121 |
\ar@setll{\fp@arrayname}{0}% |
| 122 |
\fi |
| 123 |
\else % \ifx#1\end |
| 124 |
\let\inext=\fp@readchars |
| 125 |
\ifx#1+% |
| 126 |
\else |
| 127 |
\ifx#1-% |
| 128 |
\if\ar@getsig{\fp@arrayname}-% |
| 129 |
\ar@setsig{\fp@arrayname}{+}% |
| 130 |
\else |
| 131 |
\ar@setsig{\fp@arrayname}{-}% |
| 132 |
\fi |
| 133 |
\else |
| 134 |
\if\noexpand#1\fp@decimalsign% |
| 135 |
\ifnum\fp@tempcount>-1 |
| 136 |
\advance\fp@tempcount by -1 |
| 137 |
\ar@setul{\fp@arrayname}{\fp@tempcount}% |
| 138 |
\fp@tempcount=-1 |
| 139 |
\fi |
| 140 |
\else |
| 141 |
\ar@set{\fp@arrayname}{\fp@tempcount}{#1}% |
| 142 |
\ifnum\fp@tempcount<0 |
| 143 |
\advance\fp@tempcount by -1 |
| 144 |
\else |
| 145 |
\advance\fp@tempcount by 1 |
| 146 |
\fi |
| 147 |
\fi% end \if\noexpand#1\fp@decimalsign |
| 148 |
\fi% end \ifx#1- |
| 149 |
\fi% end \ifx#1+ |
| 150 |
\fi% end \ifx#1\end |
| 151 |
\inext |
| 152 |
}% end \fp@readchars |
| 153 |
\def\fp@regget#1#2{% |
| 154 |
\if\ar@getsig{#1}-% |
| 155 |
\def#2{-}% |
| 156 |
\else |
| 157 |
\def#2{}% |
| 158 |
\fi |
| 159 |
\fp@tempcount=\ar@getul{#1}\relax |
| 160 |
\iloop |
| 161 |
\ifnum\fp@tempcount=-1 |
| 162 |
\edef#2{#2\fp@decimalsign}% |
| 163 |
\fi |
| 164 |
\edef#2{#2\ar@get{#1}{\fp@tempcount}}% |
| 165 |
\ifnum\fp@tempcount>\ar@getll{#1}\relax |
| 166 |
\advance\fp@tempcount by -1 |
| 167 |
\irepeat |
| 168 |
}% end \def\fp@regget |
| 169 |
\def\fp@cleanreg#1{% |
| 170 |
\fp@tempcount=\ar@getul{#1}\relax |
| 171 |
\iloop |
| 172 |
\ifnum\fp@tempcount>0 |
| 173 |
\ifnum\ar@get{#1}{\fp@tempcount}=0 |
| 174 |
\advance\fp@tempcount by -1 |
| 175 |
\ar@setul{#1}{\fp@tempcount}% |
| 176 |
\else |
| 177 |
\fp@tempcount=0 |
| 178 |
\fi |
| 179 |
\irepeat |
| 180 |
\fp@tempcount=\ar@getll{#1}\relax |
| 181 |
\iloop |
| 182 |
\ifnum\fp@tempcount<0 |
| 183 |
\ifnum\ar@get{#1}{\fp@tempcount}=0 |
| 184 |
\advance\fp@tempcount by 1 |
| 185 |
\ar@setll{#1}{\fp@tempcount}% |
| 186 |
\else |
| 187 |
\fp@tempcount=0 |
| 188 |
\fi |
| 189 |
\irepeat |
| 190 |
\ifnum\ar@getll{#1}=\ar@getul{#1}\relax |
| 191 |
\ifnum\ar@get{#1}{0}=0\relax |
| 192 |
\ar@setsig{#1}{+}% |
| 193 |
\fi |
| 194 |
\fi |
| 195 |
}% end \fp@regclean |
| 196 |
\def\fp@getdigit#1#2{% |
| 197 |
\ifnum#2<\ar@getll{#1}\relax |
| 198 |
\fp@setparam0% |
| 199 |
\else |
| 200 |
\ifnum#2>\ar@getul{#1}\relax |
| 201 |
\fp@setparam0% |
| 202 |
\else |
| 203 |
\fp@setparam{\ar@get{#1}{#2}}% |
| 204 |
\fi |
| 205 |
\fi |
| 206 |
}% end \fp@getdigit |
| 207 |
\def\fp@shiftright#1#2{% |
| 208 |
\edef\fp@shiftamount{\number#2}% |
| 209 |
\fp@settomax{\fp@tempcount}{\ar@getul{#1}}{-\fp@shiftamount}% |
| 210 |
\fp@settomin{\fp@tempcountii}{\ar@getll{#1}}{-\fp@shiftamount}% |
| 211 |
\def\fp@shiftnum{}% |
| 212 |
\iloop |
| 213 |
\fp@getdigit{#1}{\fp@tempcount}% |
| 214 |
\edef\fp@shiftnum{\fp@shiftnum\fp@param}% |
| 215 |
\ifnum\fp@tempcount=-\fp@shiftamount\relax |
| 216 |
\edef\fp@shiftnum{\fp@shiftnum\fp@decimalsign}% |
| 217 |
\fi |
| 218 |
\ifnum\fp@tempcount>\fp@tempcountii |
| 219 |
\advance\fp@tempcount by -1 |
| 220 |
\irepeat |
| 221 |
\fp@regread{#1}{\fp@shiftnum}% |
| 222 |
}% end \fp@shiftright |
| 223 |
\def\fp@firstnonzero#1{% |
| 224 |
\fp@regcomp{#1}{@0}% |
| 225 |
\if\fp@param=% |
| 226 |
\fp@setparam0% |
| 227 |
\else |
| 228 |
\fp@tempcount=\ar@getul{#1}\relax% |
| 229 |
\fp@tempcountii=\ar@getll{#1}\relax% |
| 230 |
\iloop |
| 231 |
\ifnum\ar@get{#1}{\fp@tempcount}>0 |
| 232 |
\fp@setparam{\number\fp@tempcount}% |
| 233 |
\fp@tempcount=\fp@tempcountii |
| 234 |
\fi |
| 235 |
\ifnum\fp@tempcount>\fp@tempcountii |
| 236 |
\advance\fp@tempcount by -1 |
| 237 |
\irepeat |
| 238 |
\fi |
| 239 |
}% end \fp@firstnonzero |
| 240 |
\def\fp@regcomp#1#2{% |
| 241 |
{% |
| 242 |
\if\ar@getsig{#1}-% |
| 243 |
\if\ar@getsig{#2}-% |
| 244 |
\fp@regcomp@main{#1}{#2}<>% |
| 245 |
\else |
| 246 |
\fp@setparam{<}% |
| 247 |
\fi |
| 248 |
\else |
| 249 |
\if\ar@getsig{#2}-% |
| 250 |
\fp@setparam{>}% |
| 251 |
\else |
| 252 |
\fp@regcomp@main{#1}{#2}><% |
| 253 |
\fi |
| 254 |
\fi |
| 255 |
}% |
| 256 |
} |
| 257 |
\def\fp@regcomp@main#1#2#3#4{% |
| 258 |
\fp@settomax{\fp@loopcount}{\ar@getul{#1}}{\ar@getul{#2}}% |
| 259 |
\fp@settomin{\fp@loopcountii}{\ar@getll{#1}}{\ar@getll{#2}}% |
| 260 |
\loop |
| 261 |
\fp@getdigit{#1}{\fp@loopcount}% |
| 262 |
\fp@tempcount=\fp@param\relax |
| 263 |
\fp@getdigit{#2}{\fp@loopcount}% |
| 264 |
\fp@tempcountii=\fp@param\relax |
| 265 |
\ifnum\fp@tempcount<\fp@tempcountii |
| 266 |
\fp@setparam{#4}% |
| 267 |
\fp@loopcount=\fp@loopcountii |
| 268 |
\else |
| 269 |
\ifnum\fp@tempcount>\fp@tempcountii |
| 270 |
\fp@setparam{#3}% |
| 271 |
\fp@loopcount=\fp@loopcountii |
| 272 |
\else |
| 273 |
\ifnum\fp@loopcount=\fp@loopcountii |
| 274 |
\fp@setparam{=}% |
| 275 |
\fi |
| 276 |
\fi |
| 277 |
\fi |
| 278 |
\ifnum\fp@loopcount>\fp@loopcountii |
| 279 |
\advance\fp@loopcount by -1 |
| 280 |
\repeat |
| 281 |
}% end \fp@regcomp@main |
| 282 |
\def\fp@regabs#1{% |
| 283 |
\ar@setsig{#1}{+}% |
| 284 |
} |
| 285 |
\def\fp@regneg#1{% |
| 286 |
\if\ar@getsig{#1}-% |
| 287 |
\ar@setsig{#1}{+}% |
| 288 |
\else |
| 289 |
\fp@regcomp{#1}{@0}% |
| 290 |
\if\fp@param=% |
| 291 |
\else |
| 292 |
\ar@setsig{#1}{-}% |
| 293 |
\fi |
| 294 |
\fi |
| 295 |
} |
| 296 |
\def\fp@reground#1#2{% |
| 297 |
\ifnum#2>\ar@getll{#1}\relax |
| 298 |
{% |
| 299 |
\fp@tempcount=#2\relax |
| 300 |
\advance\fp@tempcount by -1 |
| 301 |
\fp@getdigit{#1}{\fp@tempcount}% |
| 302 |
\ifnum\fp@param>4 |
| 303 |
\fp@regcopy{fp@temp}{@1}% |
| 304 |
\fp@shiftright{fp@temp}{#2}% |
| 305 |
\fp@regcomp{#1}{@0}% |
| 306 |
\if\fp@param<% |
| 307 |
\fp@regneg{fp@temp}% |
| 308 |
\fi |
| 309 |
\fp@regadd{#1}{fp@temp}% |
| 310 |
\fi |
| 311 |
\ifnum#2>0 |
| 312 |
\fp@loopcount=#2\relax |
| 313 |
\iloop |
| 314 |
\ifnum\fp@loopcount>0 |
| 315 |
\advance\fp@loopcount by -1 |
| 316 |
\ar@set{#1}{\fp@loopcount}{0}% |
| 317 |
\irepeat |
| 318 |
\ar@setll{#1}{0}% |
| 319 |
\else |
| 320 |
\ar@setll{#1}{#2}% |
| 321 |
\fi |
| 322 |
\fp@regget{#1}{\fp@scratch}% |
| 323 |
\fp@setparam\fp@scratch |
| 324 |
}% |
| 325 |
\fp@regread{#1}{\fp@param}% |
| 326 |
\fi |
| 327 |
} % end \fp@reground |
| 328 |
\def\fp@regcopy#1#2{% |
| 329 |
\fp@regget{#2}{\fp@scratch}% |
| 330 |
\fp@regread{#1}{\fp@scratch}% |
| 331 |
} |
| 332 |
\def\fp@regadd#1#2{% |
| 333 |
{% |
| 334 |
\if\ar@getsig{#1}\ar@getsig{#2}% |
| 335 |
\fp@settomin{\fp@loopcount}{\ar@getll{#1}}{\ar@getll{#2}}% |
| 336 |
\edef\fp@add@start{\number\fp@loopcount}% |
| 337 |
\fp@settomax{\fp@tempcount}{\ar@getul{#1}}{\ar@getul{#2}}% |
| 338 |
\edef\fp@add@finish{\number\fp@tempcount}% |
| 339 |
\fp@carryover=0 |
| 340 |
\loop |
| 341 |
\fp@getdigit{#1}{\fp@loopcount}% |
| 342 |
\fp@result=\fp@param\relax |
| 343 |
\fp@getdigit{#2}{\fp@loopcount}% |
| 344 |
\advance\fp@result by \fp@param\relax |
| 345 |
\advance\fp@result by \fp@carryover |
| 346 |
\ifnum\fp@result>9 |
| 347 |
\fp@carryover=1 |
| 348 |
\advance\fp@result by -10 |
| 349 |
\else |
| 350 |
\fp@carryover=0 |
| 351 |
\fi |
| 352 |
\ar@set{#1}{\fp@loopcount}{\fp@result}% |
| 353 |
\ifnum\fp@loopcount<\fp@add@finish\relax |
| 354 |
\advance\fp@loopcount by 1 |
| 355 |
\repeat |
| 356 |
\ifnum\fp@carryover>0 |
| 357 |
\advance\fp@loopcount by 1 |
| 358 |
\ar@set{#1}{\fp@loopcount}{\fp@carryover}% |
| 359 |
\fi |
| 360 |
\ar@setll{#1}{\fp@add@start}% |
| 361 |
\ar@setul{#1}{\fp@loopcount}% |
| 362 |
\fp@regget{#1}{\fp@scratch}% |
| 363 |
\fp@setparam\fp@scratch |
| 364 |
\else % \if sign |
| 365 |
\fp@regcopy{fp@tempi}{#1}% |
| 366 |
\fp@regcopy{fp@tempii}{#2}% |
| 367 |
\fp@regabs{fp@tempi}% |
| 368 |
\fp@regabs{fp@tempii}% |
| 369 |
\fp@regcomp{fp@tempi}{fp@tempii}% |
| 370 |
\if\fp@param>% |
| 371 |
\fp@regadd@sub{#1}{fp@tempi}{fp@tempii}% |
| 372 |
\else |
| 373 |
\fp@regadd@sub{#2}{fp@tempii}{fp@tempi}% |
| 374 |
\fi |
| 375 |
\fi % end \if sign |
| 376 |
}% |
| 377 |
\fp@regread{#1}{\fp@param}% |
| 378 |
}% end \fp@regadd |
| 379 |
\def\fp@regadd@sub#1#2#3{% |
| 380 |
\fp@regsub@restricted{#2}{#3}% |
| 381 |
\fp@regcomp{#1}{@0}% |
| 382 |
\if\fp@param<% |
| 383 |
\fp@regneg{#2}% |
| 384 |
\fi |
| 385 |
\fp@regget{#2}{\fp@scratch}% |
| 386 |
\fp@setparam\fp@scratch |
| 387 |
}% end \fp@regadd@sub |
| 388 |
\def\fp@regsub@restricted#1#2{% |
| 389 |
{% |
| 390 |
\fp@settomin{\fp@loopcount}{\ar@getll{#1}}{\ar@getll{#2}}% |
| 391 |
\edef\fp@lowermin{\number\fp@loopcount}% |
| 392 |
\fp@settomax{\fp@tempcount}{\ar@getul{#1}}{\ar@getul{#2}}% |
| 393 |
\edef\fp@uppermin{\number\fp@tempcount}% |
| 394 |
\fp@carryover=0 |
| 395 |
\loop |
| 396 |
\fp@getdigit{#1}{\fp@loopcount}% |
| 397 |
\fp@result=\fp@param\relax |
| 398 |
\fp@getdigit{#2}{\fp@loopcount}% |
| 399 |
\advance\fp@result by -\fp@param\relax |
| 400 |
\advance\fp@result by \fp@carryover |
| 401 |
\ifnum\fp@result<0 |
| 402 |
\fp@carryover=-1 |
| 403 |
\advance\fp@result by 10 |
| 404 |
\else |
| 405 |
\fp@carryover=0 |
| 406 |
\fi |
| 407 |
\ar@set{#1}{\fp@loopcount}{\fp@result}% |
| 408 |
\ifnum\fp@loopcount<\fp@uppermin\relax |
| 409 |
\advance\fp@loopcount by 1 |
| 410 |
\repeat |
| 411 |
\ifnum\fp@carryover=-1 |
| 412 |
\advance\fp@loopcount by 1 |
| 413 |
\ar@set{#1}{\fp@loopcount}{-1}% |
| 414 |
\fi |
| 415 |
\ar@setll{#1}{\fp@lowermin}% |
| 416 |
\ar@setul{#1}{\fp@loopcount}% |
| 417 |
\fp@regget{#1}{\fp@scratch}% |
| 418 |
\fp@setparam\fp@scratch |
| 419 |
}% |
| 420 |
\fp@regread{#1}{\fp@param}% |
| 421 |
}% end \fp@regsub@restricted |
| 422 |
\def\fp@regsub#1#2{% |
| 423 |
{% |
| 424 |
\fp@regneg{#2}% |
| 425 |
\fp@regadd{#1}{#2}% |
| 426 |
\fp@regget{#1}{\fp@scratch}% |
| 427 |
\fp@setparam\fp@scratch |
| 428 |
}% |
| 429 |
\fp@regread{#1}{\fp@param}% |
| 430 |
} |
| 431 |
\def\fp@regmul#1#2{% |
| 432 |
{% |
| 433 |
\fp@regcopy{fp@temp1}{@0}% |
| 434 |
\fp@loopcountii=\ar@getll{#2}\relax |
| 435 |
\xloop |
| 436 |
\fp@loopcount=\ar@getll{#1}\relax |
| 437 |
\fp@carryover=0 |
| 438 |
\def\fp@newnum{}% |
| 439 |
\loop |
| 440 |
\fp@result=\ar@get{#2}{\fp@loopcountii}\relax |
| 441 |
\multiply\fp@result by \ar@get{#1}{\fp@loopcount}\relax |
| 442 |
\advance\fp@result by \fp@carryover |
| 443 |
\ifnum\fp@result>9 |
| 444 |
\fp@carryover=\fp@result |
| 445 |
\divide\fp@carryover by 10 |
| 446 |
\fp@tempcount=\fp@carryover |
| 447 |
\multiply\fp@tempcount by 10 |
| 448 |
\advance\fp@result by -\fp@tempcount |
| 449 |
\else |
| 450 |
\fp@carryover=0 |
| 451 |
\fi |
| 452 |
\edef\fp@newnum{\number\fp@result\fp@newnum}% |
| 453 |
\ifnum\fp@loopcount<\ar@getul{#1}\relax |
| 454 |
\advance\fp@loopcount by 1 |
| 455 |
\repeat |
| 456 |
\edef\fp@newnum{\number\fp@carryover\fp@newnum}% |
| 457 |
\fp@regread{fp@temp2}{\fp@newnum}% |
| 458 |
\fp@tempcount=\fp@loopcountii |
| 459 |
\advance\fp@tempcount by -\number\ar@getll{#2}\relax |
| 460 |
\fp@shiftright{fp@temp2}{\fp@tempcount}% |
| 461 |
\fp@regadd{fp@temp1}{fp@temp2}% |
| 462 |
\ifnum\fp@loopcountii<\ar@getul{#2}\relax |
| 463 |
\advance\fp@loopcountii by 1 |
| 464 |
\xrepeat |
| 465 |
\fp@tempcount=\ar@getll{#1}\relax |
| 466 |
\advance\fp@tempcount by \ar@getll{#2}\relax |
| 467 |
\fp@shiftright{fp@temp1}{\fp@tempcount}% |
| 468 |
\if\ar@getsig{#1}\ar@getsig{#2}% |
| 469 |
\else |
| 470 |
\fp@regneg{fp@temp1}% |
| 471 |
\fi |
| 472 |
\fp@regget{fp@temp1}{\fp@scratch}% |
| 473 |
\fp@setparam\fp@scratch |
| 474 |
}% |
| 475 |
\fp@regread{#1}{\fp@param}% |
| 476 |
} % end \fp@regmul |
| 477 |
\def\fp@regdiv#1#2{% |
| 478 |
{% |
| 479 |
\fp@regcopy{fp@temp1}{#1}% |
| 480 |
\fp@regcopy{fp@temp2}{#2}% |
| 481 |
\fp@regabs{fp@temp1}% |
| 482 |
\fp@regabs{fp@temp2}% |
| 483 |
\fp@firstnonzero{fp@temp1}% |
| 484 |
\fp@loopcountii=\fp@param\relax |
| 485 |
\fp@firstnonzero{fp@temp2}% |
| 486 |
\advance\fp@loopcountii by -\fp@param\relax |
| 487 |
\fp@shiftright{fp@temp2}{\fp@loopcountii}% |
| 488 |
\def\fp@divnum{}% |
| 489 |
\ifnum\fp@loopcountii<0 |
| 490 |
\fp@tempcount=\fp@loopcountii |
| 491 |
\loop |
| 492 |
\ifnum\fp@tempcount<-1 |
| 493 |
\edef\fp@divnum{0\fp@divnum}% |
| 494 |
\advance\fp@tempcount by 1 |
| 495 |
\repeat |
| 496 |
\edef\fp@divnum{\fp@decimalsign\fp@divnum}% |
| 497 |
\fi |
| 498 |
\xloop |
| 499 |
\fp@tempcount=\fp@loopcountii |
| 500 |
\advance\fp@tempcount by 1 |
| 501 |
\ifnum\fp@tempcount>-\fp@accuracy\relax |
| 502 |
\fp@loopcount=0 |
| 503 |
\loop |
| 504 |
\fp@regcomp{fp@temp2}{fp@temp1}% |
| 505 |
\if\fp@param=% |
| 506 |
\def\fp@accuracy{0}% |
| 507 |
\gdef\fp@param{<}% |
| 508 |
\fi |
| 509 |
\if\fp@param<% |
| 510 |
\fp@regsub@restricted{fp@temp1}{fp@temp2}% |
| 511 |
\advance\fp@loopcount by 1 |
| 512 |
\repeat |
| 513 |
\ifnum\fp@loopcountii=-1 |
| 514 |
\edef\fp@divnum{\fp@divnum\fp@decimalsign}% |
| 515 |
\fi |
| 516 |
\edef\fp@divnum{\fp@divnum\number\fp@loopcount}% |
| 517 |
\fp@shiftright{fp@temp2}{-1}% |
| 518 |
\advance\fp@loopcountii by -1 |
| 519 |
\xrepeat |
| 520 |
\if\ar@getsig{#1}\ar@getsig{#2}% |
| 521 |
\fp@regread{fp@temp1}{\fp@divnum}% |
| 522 |
\else |
| 523 |
\fp@regread{fp@temp1}{-\fp@divnum}% |
| 524 |
\fi |
| 525 |
\fp@regget{fp@temp1}{\fp@scratch}% |
| 526 |
\fp@setparam\fp@scratch |
| 527 |
}% |
| 528 |
\fp@regread{#1}{\fp@param}% |
| 529 |
} |
| 530 |
\def\fp@call@bin#1#2#3#4{% |
| 531 |
{% |
| 532 |
\fp@regread{fp@user1}{#2}% |
| 533 |
\fp@regread{fp@user2}{#3}% |
| 534 |
\csname fp@reg#4\endcsname{fp@user1}{fp@user2}% |
| 535 |
\fp@regget{fp@user1}{\fp@scratch}% |
| 536 |
\fp@setparam\fp@scratch |
| 537 |
}% |
| 538 |
\edef#1{\fp@param}% |
| 539 |
} |
| 540 |
\def\fpAdd#1#2#3{\fp@call@bin{#1}{#2}{#3}{add}} |
| 541 |
\def\fpSub#1#2#3{\fp@call@bin{#1}{#2}{#3}{sub}} |
| 542 |
\def\fpMul#1#2#3{\fp@call@bin{#1}{#2}{#3}{mul}} |
| 543 |
\def\fpDiv#1#2#3{\fp@call@bin{#1}{#2}{#3}{div}} |
| 544 |
\def\fp@call@un#1#2#3{% |
| 545 |
{% |
| 546 |
\fp@regread{fp@user1}{#2}% |
| 547 |
\csname fp@reg#3\endcsname{fp@user1}% |
| 548 |
\fp@regget{fp@user1}{\fp@scratch}% |
| 549 |
\fp@setparam\fp@scratch |
| 550 |
}% |
| 551 |
\edef#1{\fp@param}% |
| 552 |
} |
| 553 |
\def\fpAbs#1#2{\fp@call@un{#1}{#2}{abs}} |
| 554 |
\def\fpNeg#1#2{\fp@call@un{#1}{#2}{neg}} |
| 555 |
\def\fpRound#1#2#3{% |
| 556 |
{% |
| 557 |
\fpRegSet{fp@user1}{#2}% |
| 558 |
\fpRegRound{fp@user1}{#3}% |
| 559 |
\fpRegGet{fp@user1}{\fp@scratch}% |
| 560 |
\fp@setparam\fp@scratch |
| 561 |
}% |
| 562 |
\edef#1{\fp@param}% |
| 563 |
} |
| 564 |
\def\fpRegSet#1#2{\fp@regread{#1}{#2}} |
| 565 |
\def\fpRegGet#1#2{\fp@regget{#1}{#2}} |
| 566 |
\def\fpRegAdd#1#2{\fp@regadd{#1}{#2}} |
| 567 |
\def\fpRegSub#1#2{\fp@regsub{#1}{#2}} |
| 568 |
\def\fpRegMul#1#2{\fp@regmul{#1}{#2}} |
| 569 |
\def\fpRegDiv#1#2{\fp@regdiv{#1}{#2}} |
| 570 |
\def\fpRegAbs#1{\fp@regabs{#1}} |
| 571 |
\def\fpRegNeg#1{\fp@regneg{#1}} |
| 572 |
\def\fpRegCopy#1#2{\fp@regcopy{#1}{#2}} |
| 573 |
\def\fpRegRound#1#2{\fp@reground{#1}{#2}} |
| 574 |
\def\fpAccuracy#1{\edef\fp@accuracy{#1}} |
| 575 |
\fpAccuracy{5} |
| 576 |
\def\fpDecimalSign#1{\edef\fp@decimalsign{#1}} |
| 577 |
\fpDecimalSign{,} |
| 578 |
\def\fpThousandSep#1{\edef\fp@thousandsep{#1}} |
| 579 |
\fpThousandSep{} |
| 580 |
\fp@regread{@0}{0} |
| 581 |
\fp@regread{@1}{1} |
| 582 |
\catcode`\@=\atcatcode\relax |
| 583 |
\endinput |
| 584 |
%% |
| 585 |
%% End of file `fltpoint.tex'. |