Debian Codegraph @

texmf-dist/doc/latex/fp/README

raw
1 fp-package
2
3 (c) Michael Mehlich 1994 -- 1999
4 contributions by: Denis Girou
5 acknowledgment to: Denis Girou, Miroslav Balda, Ricardo Sanchez Carmenes
6
7 % Copyright 1994 -- 1999 Michael Mehlich
8 % This package can be redistributed and/or modified under the terms
9 % of the LaTeX Project Public License Distributed from CTAN
10 % archives at http://www.latex-project.org/lppl.txt either
11 % version 1 of the License, or any later version.
12
13 (current) e-mail: [email protected]; [email protected]
14
15 Fixed point arithmetic for TeX with numbers ranging from
16 -999999999999999999.999999999999999999
17 to
18 +999999999999999999.999999999999999999
19
20 TODO:
21 - better documentation (it is really bad)
22
23 USAGE:
24 - LaTeX2e:
25 \usepackage[<options>]{fp}
26 where the following options are known:
27 nomessages: don't print messages about the functions that are
28 just computed
29 debug: print debug messages (mainly for \FPupn)
30 - LaTeX2.09:
31 include lfp.sty in the document preamble, i.e.
32 \documentstyle[...,lfp,...]{...}
33 - TeX:
34 \input fp.tex
35
36 MsDos/Windows Users:
37 It may be necessary to rename some files such that they just have a length of
38 eight characters (plus a three character suffix).
39 The following renaming e.g. works for emtex:
40 Original name Name for emtex
41 defpattern.sty defpaern.sty
42 fp-addons.sty fp-adons.sty
43 fp-random.sty fp-radom.sty
44
45 FILES AND THEIR CONTENTS:
46 - readme.fp:
47 this file
48 - fp.sty
49 includes all files
50 - defpattern.sty:
51 only for internal usage
52 - fp-basic.sty:
53 The following macros are public ones to be used in the document:
54 %controlling messages
55 \FPmessagestrue % print standard FP-messages (default)
56 \FPmessagesfalse % suppress standard FP-messages
57 \FPdebugtrue % print debug messages (mainly for upn)
58 \FPdebugfalse % suppress debug messages (default)
59 %introduction of new values
60 \FPset#1#2 % #1 := #2 (#1 may be macro or string)
61 %print values
62 \FPprint#1 % prints #1 (#1 may be macro or string)
63 %binary operations
64 \FPadd#1#2#3 % #1 := #2+#3
65 \FPdiv#1#2#3 % #1 := #2/#3
66 \FPmul#1#2#3 % #1 := #2*#3
67 \FPsub#1#2#3 % #1 := #2-#3
68 %unary operations
69 \FPabs#1#2 % #1 := abs(#2)
70 \FPneg#1#2 % #1 := -#2
71 %binary relations
72 \FPiflt#1#2...\else...\fi % #1 < #2 ?
73 \FPifeq#1#2...\else...\fi % #1 = #2 ?
74 \FPifgt#1#2...\else...\fi % #1 > #2 ?
75 %unary relations
76 \FPifneg#1 ...\else...\fi % #1 < 0 ?
77 \FPifpos#1 ...\else...\fi % #1 >= 0 ?
78 \FPifzero#1...\else...\fi % #1 = 0 ?
79 \FPifint#1 ...\else...\fi % #1 is integer ?
80 %repeat last test
81 \ifFPtest ...\else...\fi % repeat last test
82 - fp-addons.sty
83 The following macros are public ones to be used in the document:
84 %binary operations
85 \FPmin#1#2#3 % #1 = min(#2,#3)
86 \FPmax#1#2#3 % #1 = max(#2,#3)
87 - fp-eqn.sty (No warranty on correctness and especially on numerical problems!)
88 The following macros are public ones to be used in the document:
89 \FPlsolve#1#2#3
90 % #1 := x with #2*x+#3=0
91 \FPqsolve#1#2#3#4#5
92 % #1,#2 := x with #3*x^2+#4*x+#5 = 0
93 \FPcsolve#1#2#3#4#5#6#7
94 % #1,#2,#3 := x with #4*x^3+#5*x^2+#6*x+#7 = 0
95 \FPqqsolve#1#2#3#4#5#6#7#8#9
96 % #1,#2,#3,#4 := x with #5*x^4+#6*x^3+#7*x^2+#8*x+#9 = 0
97 The resulting solutions are all real values. If there do not
98 exist as much solutions you get a warning message and some
99 other solutions occur several times in the solution vector.
100 - fp-exp.sty
101 The following macros are public ones to be used in the document:
102 \FPe % 2.718281828459045235
103 \FPexp#1#2 % #1 := e^(#2)
104 \FPln#1#2 % #1 := ln(#2)
105 \FPpow#1#2#3 % #1 := (#2)^(#3)
106 \FProot#1#2#3 % #1 := (#2)^(1/#3)
107 - fp-random.sty
108 The following macros are public ones to be used in the document:
109 \FPseed=#1 % set seed counter for random number generation
110 \FPrandom#1 % #1 := a random number between 0 and 1
111 - fp-pas.sty
112 The following macros are public ones to be used in the document:
113 \FPpascal#1#2 % #1 := #2-th line of the pascal triangle
114 - fp-snap.sty:
115 The following macros are public ones to be used in the document:
116 \FPround#1#2#3 % #1 := #2 rounded to #3 digits after '.'
117 \FPtrunc#1#2#3 % #1 := #2 truncated to #3 digits after '.'
118 \FPclip#1#2 % #1 := #2 with all unnecessary 0's removed
119 - fp-trigo.sty:
120 The following macros are public ones to be used in the document:
121 \FPpi % 3.141592653589793238
122 \FPsin#1#2 % #1 := sin(#2)
123 \FPcos#1#2 % #1 := cos(#2)
124 \FPsincos#1#2#3 % #1 := sin(#3), #2 := cos(#3)
125 \FPtan#1#2 % #1 := tan(#2)
126 \FPcot#1#2 % #1 := cot(#2)
127 \FPtancot#1#2#3 % #1 := tan(#3), #2 := cot(#3)
128 \FParcsin#1#2 % #1 := arcsin(#2)
129 \FParccos#1#2 % #1 := arccos(#2)
130 \FParcsincos#1#2#3 % #1 := arcsin(#3), #2 := arccos(#3)
131 \FParctan#1#2 % #1 := arctan(#2)
132 \FParccot#1#2 % #1 := arccot(#2)
133 \FParctancot#1#2#3 % #1 := arctan(#3), #2 := arccot(#3)
134 - fp-upn.sty:
135 The following macros are public ones to be used in the document:
136 \FPupn#1#2 % #1 := eval(#2) where eval evaluates the
137 upn-expression #2
138 Known operations are:
139 +,add,-,sub,*,mul,/,div,abs,neg,min,max,
140 round,trunc,clip,e,exp,ln,pow,root,pi,sin,cos,
141 sincos,tan,cot,tancot,arcsin,arccos,arcsincos,
142 arctan,arccot,arctancot,pop,swap,copy
143 where
144 pop removes the top element
145 swap exchanges the first two elements
146 copy copies the top element
147 Example 1:
148 The macro call
149 \FPupn\result{17 2.5 + 17.5 - 2 1 + * 2 swap /}
150 is equivalent to
151 \result := ((17.5 - (17 + 2.5)) * (2 + 1)) / 2
152 and evaluates to
153 \def\result{-3.000000000000000000}
154 Afterwards the macro call
155 \FPupn\result{\result{} -1 * 0.2 + sin 2 round}
156 ^^ the "{}" is necessary!
157 is equivalent to
158 \result := round_2(sin((\result * -1) + 0.2))
159 and evaluates to
160 \def\result{-0.06}
161 Example 2:
162 As "result" is an abbreviation of "\result{}" you may
163 write
164 \FPupn{result}{17 2.5 + 17.5 - 2 1 + * 2 swap /}
165 and
166 \FPupn{result}{result -1 * 0.2 + sin 2 round}
167 instead leading to the same results.
168 This is even true for other macro names using e.g. "x" for "\x{}"
169 and so on. But be careful with it. We may introduce new constants
170 in further versions overwriting these abbreviations.
171 - fp-eval.sty:
172 The following macros are public ones to be used in the document:
173 \FPeval#1#2 % #1 := eval(#2) where eval evaluates the
174 expression #2
175 ATTENTION: Do not use macro names with \. for its own
176 Use only the name or the macro surrounded by (, and ) instead,
177 i.e. do not write "\value{}" but "value" or "(\value)".
178 This is needed to avoid problems with a prefix "-" of numbers.
179 (I do not intend to write a more complex parsing routine in future.
180 But if you do so, just send it to me.
181 )
182 Known infix operations are
183 +, -, *, /, ^ for add, sub, mul, div, pow
184 Each other operation is a prefix one that needs
185 a (comma or colon seperated) list of subexpressions.
186 Exception: The unary prefix operation - is not known!
187 (Use the function neg instead.)
188 Example 1:
189 With
190 \edef\result{11}
191 and
192 \FPeval\result{round(root(2,sin(result + 2.5)):2)}
193 or
194 \FPeval{result}{round(root(2,sin(result + 2.5)):2)}
195 \result becomes the value 0.90
196 Example 2:
197 \FPeval\result{clip(2*3+5*6)} results to 36
198 \FPeval\result{clip(2*(3+5)*6)} results to 96
199
200 KNOWN BUGS:
201 - does not work with multido.sty/multido.tex
202 Reason:
203 multido uses the same macro names \FPadd and \FPsub
204 Recommended Solution:
205 Patch multido.tex, i.e. apply the following substitutions:
206 FPadd -> mdo@FPadd
207 FPsub -> mdo@FPsub
208
209 - incompatibility with french style of babel
210 this only affects macros using the colon (:)
211 Recommended Solution:
212 Load the fp-package before babel with french style
213 Other Possible Solution:
214 Use \catcode`\:=12 after loading babel with french style
215
216 - others:
217 Currently not known, but, though we do not, we could give
218 a warranty of their existence ...
219
220 HISTORY:
221 Date By File New Version
222
223 Jan. 14, 2019 Peter Wang documentation V2.1d
224 improved documentation based on the original README.txt, with examples to show the syntax.
225
226 Jan. 14, 2019 Enrico Gregorio `fp-exp.sty' and `lfp.sty` V2.1d
227 Fixed two unprotected end-of-lines in the above files that can, under certain circumstances, add spaces in the output, causing unwanted drifting.
228
229 Oct. 21, 1996 Michael Mehlich fp-upn.sty V2.1c
230 better debug messages (especially giving results of one step computations)
231
232 May. 13, 1996 Michael Mehlich fp-basic.sty V1.2d
233 \newcount and \countdef have interfered each other
234 when the first newcount uses a counter number less
235 than 60, the result has been wrong results when using
236 the package with plain tex (a problem that has been
237 reported by Ricardo Sanchez Carmenes)
238
239 May. 13, 1996 Michael Mehlich all files -
240 problems with unwanted spaces removed
241 (bug reported by Ricardo Sanchez Carmenes)
242
243 May. 28, 1995 Michael Mehlich fp-basic.sty V1.2c
244 modified \FPset and added \FPprint
245
246 Apr. 27, 1995 Michael Mehliche fp-trigo.sty V0.9e
247 incorrect result of sine for 3/2pi fixed
248 (bug reported by Miroslav Balda)
249
250 Apr. 14, 1995 Michael Mehlich fp-trigo.sty V0.9d
251 infinite loop in computing sine and cosine fixed
252 (bug reported by Miroslav Balda)
253
254 Apr. 05, 1995 Michael Mehlich fp-snap.sty V1.0a
255 rounding bug in FPround fixed
256 (bug reported by Miroslav Balda)
257
258 Apr. 04, 1995 Michael Mehlich fp.tex -
259 lfp.sty -
260 a redefinition of \loop..\repeat added not to get into
261 trouble with its behaviour within my macros
262 (bug reported by Miroslav Balda)
263
264 Apr. 04, 1995 Michael Mehlich fp-basic.sty V1.2b
265 added a value introduction command FPset
266
267 Apr. 03, 1995 Michael Mehlich fp-eqn.sty V0.4
268 added solution algorithms for cubic and 4-th degree equations
269
270 Apr. 03, 1995 Michael Mehlich fp-trigo.sty V0.9c
271 added some % at end of lines not to introduce unwanted spaces
272 removed some debug informations that have accidently been left in
273
274 Apr. 03, 1995 Michael Mehlich fp-exp.sty V0.7e
275 added some % at end of lines not to introduce unwanted spaces
276
277 Apr. 03, 1995 Michael Mehlich fp-upn.sty V2.1b
278 fp-eval.sty V0.9a
279 added support of sgn
280
281 Apr. 03, 1995 Michael Mehlich fp-basic.sty V1.2a
282 added new command \FPsgn
283
284 Apr. 02, 1995 Michael Mehlich fp-exp.sty V0.7d
285 bug corrected, power of 0 by f # 0 now is 0 and no longer
286 leads to an error message
287
288 Apr. 02, 1995 Michael Mehlich fp.sty V0.8
289 added fp-eval.sty to list of required packages
290
291 Apr. 02, 1995 Michael Mehlich fp-upn.sty V2.1a
292 some modifications to work with fp-eval.sty
293
294 Apr. 02, 1995 Michael Mehlich fp-eval.sty V0.9
295 inital version
296
297 Mar. 15, 1995 Michael Mehlich fp.sty V0.7a
298 added fp-addons.sty, fp-eqn.sty to list of required packages
299
300 Mar. 15, 1995 Michael Mehlich fp-eqn.sty V0.2
301 initial version
302
303 Mar. 15, 1995 Michael Mehlich fp-exp.sty V0.7c
304 bug corrected, root of 0 now is 0 and no longer leads to
305 an error message
306
307 Mar. 15, 1995 Michael Mehlich fp-upn.sty V2.1
308 allow macros to be given without \ and {} surrounding
309 support of min, max added
310
311 Mar. 15, 1995 Michael Mehlich fp-addons.sty V0.1
312 initial version
313
314 Feb. 23, 1995 Denis Girou fp-random.sty V1.0a
315 more elaborated comments
316
317 Feb. 21, 1995 Michael Mehlich fp-trigo.sty V0.9b
318 corrected overflow test for arcsin and arccos
319
320 Feb. 18, 1995 Michael Mehlich fp-upn.sty V2.0
321 added debug messages for fp-upn.sty
322 (recommended by Denis Girou)
323
324 Feb. 18, 1995 Michael Mehlich fp.sty V0.7
325 added fp-random.sty to list of required packages
326
327 Feb. 18, 1995 Michael Mehlich fp-basic.sty V1.2
328 printing fp-messages is conditional only (default: true)
329 introduced macro for printing debug messages (default: do not print)
330 (recommmended by Denis Girou)
331
332 Feb. 18, 1995 Michael Mehlich fp-exp.sty V0.7c
333 corrected bugs in \FP@pow and \FP@root writing messages to
334 ordinary text
335 (reported by Denis Girou)
336
337 Feb. 17, 1995 Denis Girou fp-random.sty V1.0
338 introduced
339
340 Feb. 17, 1995 Michael Mehlich fp-basic.sty V1.1f
341 corrected \FP@strip introduced in version V1.1e
342 as it has to but did not hande + and -
343
344 Feb. 17, 1995 Michael Mehlich fp-basic.sty V1.1e
345 corrected \FP@strip introduced in version V1.1d
346 as it has to but did not hande empty parameters
347
348 Feb. 17, 1995 Michael Mehlich fp-basic.sty V1.1d
349 bug in scanning numbers by \FP@readvalue in connection
350 with number-macros of \FPupn corrected
351 (thanks for Denis Girou reporting this bug)
352
353 Nov. 19, 1994 Michael Mehlich fp.sty V0.6
354 package date changed
355
356 Nov. 19, 1994 Michael Mehlich fp-basic.sty V1.1c
357 bug in \FP@correctintcounter corrected
358
359 Nov. 19, 1994 Michael Mehlich fp-upn.sty V1.1
360 handling of arctan, arccot, arctancot added
361
362 Nov. 19, 1994 Michael Mehlich fp-trigo.sty V0.9a
363 \FParctan, \FParccot, \FParctancot added
364
365 Oct. 27, 1994 Michael Mehlich lfp.sty -
366 introduced
367
368 Oct. 27, 1994 Michael Mehlich fp.tex -
369 introduced
370
371 Oct. 15, 1994 Michael Mehlich readme.fp -
372 this history changed for better readability
373
374 Oct. 15, 1994 Michael Mehlich fp-exp.sty V0.7b
375 subtraction bug in \FP@@exp corrected
376
377 Oct. 15, 1994 Michael Mehlich fp-basic.sty V1.1b
378 subtraction in \FP@counttimes changed
379
380 Oct. 15, 1994 Michael Mehlich fp-trigo.sty V0.7b
381 error message, if \FP@modtwopi does not lead to correct result
382 (this shouldn't be possible)
383 subtraction in \FP@@cos corrected
384
385 Oct. 12, 1994 Michael Mehlich fp.sty V0.5b
386 prevent files included from sending messages
387
388 Oct. 12, 1994 Michael Mehlich readme.fp -
389 changed entry for defpattern.sty in this history to reflect
390 original source for defpattern.sty
391
392 Oct. 12, 1994 Michael Mehlich defpattern.sty -
393 source notice in message corrected
394
395 Oct. 12, 1994 Michael Mehlich fp-exp.sty -
396 start message for \FPpow changed
397
398 Oct. 12, 1994 Michael Mehlich fp-trigo.sty -
399 unnecessary \typeout removed
400
401 Oct. 3, 1994 Michael Mehlich, fp.sty V0.5
402 additional styles included by fp.sty
403
404 Oct. 3, 1994 Michael Mehlich fp-upn.sty V1.0
405 first version
406
407 Oct. 3, 1994 Michael Mehlich defpattern.sty -
408 modification of the \howto-macro in TeX and TUG NEWS
409 from an article by Alan Jeffrey
410 no version number, no copyright (public domain)
411 TeX and TUG News 2(2) writes in the section "Mission Statement":
412 "The entire contents of this newsletter are being placed in
413 the public domain."
414
415 Oct. 3, 1994 Michael Mehlich fp-basic.sty V1.1
416 bug in \FPadd corrected
417
418 Aug. 29, 1994 Michael Mehlich fp.sty V0.3
419 additional styles included by fp.sty
420
421 Aug. 29, 1994 Michael Mehlich fp-trigo.sty V0.7
422 first version
423
424 Aug. 29, 1994 Michael Mehlich fp-pas.sty V1.0
425 first version
426
427 Aug. 29, 1994 Michael Mehlich fp-exp.sty V0.7
428 first version
429
430 Aug. 12, 1994 Michael Mehlich fp.sty V0.2
431 first version
432
433 Aug. 10, 1994 Michael Mehlich fp-snap.sty V1.0
434 first version
435
436 Apr. 20, 1994 Michael Mehlich fp-basic.sty V1.0
437 \FPabs added
438
439 Apr. 12, 1994 Michael Mehlich fp-basic.sty V0.99
440 division algorithm added
441
442 Feb. 03, 1994 Michael Mehlich fp-basic.sty V0.8
443 all macros are completely rewritten to be able to use an increased
444 range of numbers
445
446 Jan. 18, 1994 Michael Mehlich fp-basic.sty V0.2
447 bug in \FP@store corrected
448
449 Jan. 17, 1994 Michael Mehlich fp-basic.sty V0.1
450 the file realcalc.tex V1.0, (C) Frank Buchholz has been renamed to
451 fp-basic.sty V0.1 with all macros renamed, \@trunc removed
452
453 COPYING:
454 - Permission to use, copy, modify, and distribute this software and its
455 documentation for any purpose and without fee is hereby granted,
456 provided that the above copyright notice, the above history with your
457 modifications added, and this permission notice appear in all copies
458 and modified versions.
459 - The copyright holder disclaim all warranties with regard to this
460 software, including all implied warranties of merchantability and
461 fitness, in no event shall the copyright holder be liable for any
462 special, indirect or consequential damages or any damages whatsoever
463 resulting from loss of use, data or profits, whether in an action of
464 contract, negligence or other tortious action, arising out of or in
465 connection with the use or performance of this software.