diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/fp/fp-addons.sty |
Initial commit
Diffstat (limited to 'macros/latex/contrib/fp/fp-addons.sty')
-rw-r--r-- | macros/latex/contrib/fp/fp-addons.sty | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/macros/latex/contrib/fp/fp-addons.sty b/macros/latex/contrib/fp/fp-addons.sty new file mode 100644 index 0000000000..d91057d2eb --- /dev/null +++ b/macros/latex/contrib/fp/fp-addons.sty @@ -0,0 +1,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% +} |