summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/fp/fp-addons.sty
blob: d91057d2eb08f6153eccf5fcdb0e118863152ece (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{fp-addons}[1995/03/15]

\def\FP@addonsversion{0.1}
\message{%
  `Fixed Point Arithmetic Addons',\space%
  Version \FP@addonsversion\space%
  \space(C) Michael Mehlich%
  \space\space\space\space\space\space\space%
  \space\space\space\space\space\space\space%
}

%%%public area (macros which may be used)%%%

\def\FPmin#1#2#3{\FP@min#1{#2}{#3}} % #1:=min(#2,#3)
\def\FPmax#1#2#3{\FP@max#1{#2}{#3}} % #1:=max(#2,#3)

%%%private fp-area (don't use these macros)%%%

%compute minimum of two values
\def\FP@min#1#2#3{%
  % #1 macro, which gets the result
  % #2 value one
  % #3 value two
  \FP@beginmessage{MIN}%
  %
  {\def\FP@beginmessage##1{}%
   \def\FP@endmessage##1{}%
   %
   \FPiflt{#2}{#3}%
     \edef\FP@tmp{#2}%
   \else%
     \edef\FP@tmp{#3}%
   \fi%
   %
   \global\let\FP@tmp\FP@tmp%
  }%
  %
  \FP@endmessage{}%
  %
  \let#1\FP@tmp%
}

%compute maximum of two values
\def\FP@max#1#2#3{%
  % #1 macro, which gets the result
  % #2 value one
  % #3 value two
  \FP@beginmessage{MAX}%
  %
  {\def\FP@beginmessage##1{}%
   \def\FP@endmessage##1{}%
   %
   \FPifgt{#2}{#3}%
     \edef\FP@tmp{#2}%
   \else%
     \edef\FP@tmp{#3}%
   \fi%
   %
   \global\let\FP@tmp\FP@tmp%
  }%
  %
  \FP@endmessage{}%
  %
  \let#1\FP@tmp%
}