fp-package
(c) Michael Mehlich and Denis Girou, 1994, 1995
(current) e-mail: mehlich@informatik.uni-muenchen.de
Fixed point arithmetic for TeX with numbers ranging from
-999999999999999999.999999999999999999
to
+999999999999999999.999999999999999999
USAGE:
- LaTeX2e:
    \usepackage[<options>]{fp}
where the following options are known:
nomessages:  don't print messages about the functions that are
just computed
debug: print debug messages (mainly for \FPupn)
- LaTeX2.09:
    include lfp.sty in the document preamble, i.e.
    \documentstyle[...,lfp,...]{...}
- TeX:
    \input fp.tex
FILES AND THEIR CONTENTS:
- readme.fp:
    this file
- fp.sty
    includes all files
- defpattern.sty:
    only for internal usage
- fp-basic.sty:
The following macros are public ones to be used in the document:
%controlling messages
\FPmessagestrue % print standard FP-messages (default)
\FPmessagesfalse   % suppress standard FP-messages
\FPdebugtrue     % print debug messages (mainly for upn)
\FPdebugfalse % suppress debug messages (default)
      %binary operations
        \FPadd#1#2#3 % #1 := #2+#3
        \FPdiv#1#2#3 % #1 := #2/#3
        \FPmul#1#2#3 % #1 := #2*#3
        \FPsub#1#2#3 % #1 := #2-#3
      %unary operations
        \FPabs#1#2 % #1 := abs(#2)
        \FPneg#1#2 % #1 := -#2

        %binary relations
          \FPiflt#1#2...\else...\fi % #1 < #2 ?
          \FPifeq#1#2...\else...\fi % #1 = #2 ?
          \FPifgt#1#2...\else...\fi % #1 > #2 ?
        %unary relations
          \FPifneg#1 ...\else...\fi % #1 <  0 ?
          \FPifpos#1 ...\else...\fi % #1 >= 0 ?
          \FPifzero#1...\else...\fi % #1 =  0 ?
          \FPifint#1 ...\else...\fi % #1 is integer ?
        %repeat last test
          \ifFPtest  ...\else...\fi % repeat last test
  - fp-exp.sty:
      The following macros are public ones to be used in the document:
        \FPe % 2.718281828459045235
\FPexp#1#2  % #1 := e^(#2)
\FPln#1#2 % #1 := ln(#2)
\FPpow#1#2#3   % #1 := (#2)^(#3)
\FProot#1#2#3        % #1 := (#2)^(1/#3)
  - fp-random.sty
      The following macros are public ones to be used in the document:
\FPseed=#1 % set seed counter for random number generation
\FPrandom#1 % #1 := a random number
  - fp-pas.sty
      The following macros are public ones to be used in the document:
        \FPpascal#1#2  % #1 := #2-th line of the pascal triangle
  - fp-snap.sty:
      The following macros are public ones to be used in the document:
\FPround#1#2#3       % #1 := #2 rounded   to #3 digits after '.'
\FPtrunc#1#2#3       % #1 := #2 truncated to #3 digits after '.'
        \FPclip#1#2 % #1 := #2 with all unnecessary 0's removed
  - fp-trigo.sty:
      The following macros are public ones to be used in the document:
\FPpi  % 3.141592653589793238
\FPsin#1#2 % #1 := sin(#2)
\FPcos#1#2  % #1 := cos(#2)
\FPsincos#1#2#3 % #1 := sin(#3), #2 := cos(#3)
\FPtan#1#2 % #1 := tan(#2)
\FPcot#1#2  % #1 := cot(#2)
\FPtancot#1#2#3  % #1 := tan(#3), #2 := cot(#3)
    \FParcsin#1#2 % #1 := arcsin(#2)
\FParccos#1#2      % #1 := arccos(#2)
\FParcsincos#1#2#3   % #1 := arcsin(#3), #2 := arccos(#3)
\FParctan#1#2  % #1 := arctan(#2)
\FParccot#1#2  % #1 := arccot(#2)
\FParctancot#1#2#3 % #1 := arctan(#3), #2 := arccot(#3)
  - fp-upn.sty:

      The following macros are public ones to be used in the document:
        \FPupn#1#2  % #1 := eval(#2) where eval evaluates the
  upn-expression #2
Known operations are:
+,-,*,/,abs,neg,round,trunc,clip,e,exp,ln,pow,root,pi,sin,cos,
sincos,tan,cot,tancot,arcsin,arccos,arcsincos,
arctan,arccot,arctancot,pop,swap,copy
where
  pop  removes the top element
  swap exchanges the first two elements
  copy copies the top element
Example:
The macro call
          \FPupn\result{17 2.5 + 17.5 - 2 1 + * 2 swap /}
is equivalent to
  \result := ((17.5 - (17 + 2.5)) * (2 + 1)) / 2
and evaluates to
  \def\result{-3.000000000000000000}
Afterwards the macro call
          \FPupn\result{\result{} -1 * 0.2 + sin 2 round}
                       ^^the "{}" is necessary!
is equivalent to
  \result := round_2(sin((\result * -1) + 0.2))
and evaluates to
          \def\result{-0.06}
KNOWN BUGS:
- does not work with multido.sty/multido.tex
Reason:
 multido uses the same macro names \FPadd and \FPsub
Recommended Solution:
 Patch multido.tex, i.e. apply the following substitutions:
   FPadd -> mdo@FPadd
   FPsub -> mdo@FPsub
HISTORY:
Date By File New Version
Feb. 18, 1995 Michael Mehlich fp-upn.sty V2.0
added debug messages for fp-upn.sty
(recommended by Denis Girou)
Feb. 18, 1995 Michael Mehlich fp.sty V0.7
added fp-random.sty to list of required packages
Feb. 18, 1995 Michael Mehlich fp-basic.sty V1.2

printing fp-messages is conditional only (default: true)
introduced macro for printing debug messages (default: do not print)
(recommmended by Denis Girou)
Feb. 18, 1995 Michael Mehlich fp-exp.sty V0.7c
corrected bugs in \FP@pow and \FP@root writing messages to
ordinary text
(reported by Denis Girou)
Feb. 17, 1995 Denis Girou fp-random.sty V1.0
Feb. 17, 1995 Michael Mehlich fp-basic.sty  V1.1f
corrected \FP@strip introduced in version V1.1e
as it has to but did not hande + and -
Feb. 17, 1995 Michael Mehlich fp-basic.sty  V1.1e
corrected \FP@strip introduced in version V1.1d
as it has to but did not hande empty parameters
Feb. 17, 1995 Michael Mehlich fp-basic.sty V1.1d
bug in scanning numbers by \FP@readvalue in connection
with number-macros of \FPupn corrected
(thanks for Denis Girou reporting this bug)
Nov. 19, 1994 Michael Mehlich fp.sty V0.6
package date changed
Nov. 19, 1994 Michael Mehlich fp-basic.sty V1.1c
bug in \FP@correctintcounter corrected
Nov. 19, 1994 Michael Mehlich fp-upn.sty V1.1
handling of arctan, arccot, arctancot added
Nov. 19, 1994 Michael Mehlich fp-trigo.sty V0.9a
\FParctan, \FParccot, \FParctancot added
Oct. 27, 1994  Michael Mehlich lfp.sty -
introduced
Oct. 27, 1994  Michael Mehlich fp.tex -
introduced
Oct. 15, 1994  Michael Mehlich readme.fp -
this history changed for better readability
     Oct. 15, 1994 Michael Mehlich fp-exp.sty V0.7b

subtraction bug in \FP@@exp corrected
Oct. 15, 1994 Michael Mehlich fp-basic.sty V1.1b
subtraction in \FP@counttimes changed
Oct. 15, 1994 Michael Mehlich fp-trigo.sty V0.7b
error message, if \FP@modtwopi does not lead to correct result
(this shouldn't be possible)
subtraction in \FP@@cos corrected
Oct. 12, 1994  Michael Mehlich fp.sty V0.5b
prevent files included from sending messages
Oct. 12, 1994 Michael Mehlich readme.fp -
changed entry for defpattern.sty in this history to reflect
original source for defpattern.sty
Oct. 12, 1994 Michael Mehlich defpattern.sty -
source notice in message corrected
Oct. 12, 1994  Michael Mehlich  fp-exp.sty -
start message for \FPpow changed
Oct. 12, 1994   Michael Mehlich fp-trigo.sty -
unnecessary \typeout removed
Oct. 3, 1994  Michael Mehlich,  fp.sty V0.5
additional styles included by fp.sty
Oct. 3, 1994  Michael Mehlich  fp-upn.sty V1.0
first version
Oct. 3, 1994  Michael Mehlich  defpattern.sty -
modification of the \howto-macro in TeX and TUG NEWS
from an article by Alan Jeffrey
no version number, no copyright (public domain)
TeX and TUG News 2(2) writes in the section "Mission Statement":
"The entire contents of this newsletter are being placed in
the public domain."
Oct. 3, 1994 Michael Mehlich fp-basic.sty V1.1
bug in \FPadd corrected
Aug. 29, 1994 Michael Mehlich  fp.sty V0.3
additional styles included by fp.sty

Aug. 29, 1994 Michael Mehlich   fp-trigo.sty V0.7
first version
Aug. 29, 1994  Michael Mehlich  fp-pas.sty V1.0
first version
Aug. 29, 1994  Michael Mehlich  fp-exp.sty V0.7
first version
Aug. 12, 1994 Michael Mehlich fp.sty V0.2
first version
Aug. 10, 1994 Michael Mehlich fp-snap.sty V1.0
first version
Apr. 20, 1994 Michael Mehlich fp-basic.sty V1.0
\FPabs added
Apr. 12, 1994 Michael Mehlich fp-basic.sty V0.99
division algorithm added
Feb. 03, 1994 Michael Mehlich fp-basic.sty V0.8
all macros are completely rewritten to be able to use an increased
range of numbers
Jan. 18, 1994 Michael Mehlich fp-basic.sty V0.2
bug in \FP@store corrected
Jan. 17, 1994  Michael Mehlich fp-basic.sty V0.1
the file realcalc.tex V1.0, (C) Frank Buchholz has been renamed to
fp-basic.sty V0.1 with all macros renamed, \@trunc removed
COPYING:
- Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice, the above history with your
modifications added, and this permission notice appear in all copies
and modified versions.
- The copyright holder disclaim all warranties with regard to this
software, including all implied warranties of merchantability and
fitness, in no event shall the copyright holder be liable for any
special, indirect or consequential damages or any damages whatsoever
resulting from loss of use, data or profits, whether in an action of
contract, negligence or other tortious action, arising out of or in
connection with the use or performance of this software.