diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/pstricks-add/pst-fp.tex')
-rw-r--r-- | Master/texmf-dist/tex/generic/pstricks-add/pst-fp.tex | 84 |
1 files changed, 80 insertions, 4 deletions
diff --git a/Master/texmf-dist/tex/generic/pstricks-add/pst-fp.tex b/Master/texmf-dist/tex/generic/pstricks-add/pst-fp.tex index ff145b5e251..1ad488864df 100644 --- a/Master/texmf-dist/tex/generic/pstricks-add/pst-fp.tex +++ b/Master/texmf-dist/tex/generic/pstricks-add/pst-fp.tex @@ -1,4 +1,4 @@ -%% $Id: pst-fp.tex 148 2009-11-14 09:01:39Z herbert $ +%% $Id: pst-fp.tex 155 2009-11-30 07:58:45Z herbert $ %% %% %% This is file `pst-fp.tex', @@ -15,7 +15,8 @@ %% in directory macros/latex/base/lppl.txt. %% %% DESCRIPTION: -%% `pst-fp' is a PSTricks related package for a division +%% `pst-fp' is a PSTricks related package for a division, +%% multiplication and addition %% \csname PSTFPloaded\endcsname \let\PSTFPloaded\endinput @@ -23,8 +24,8 @@ % Requires some packages \ifx\PSTricksLoaded\endinput\else\input pstricks \fi % -\def\fileversion{0.03} -\def\filedate{2009/11/14} +\def\fileversion{0.04} +\def\filedate{2009/11/24} \message{`pst-fp' v\fileversion, \filedate\space (hv)} % \edef\PstAtCode{\the\catcode`\@} \catcode`\@=11\relax @@ -33,6 +34,7 @@ % -999999999999999999.999999999999999999 % and +999999999999999999.999999999999999999 +\def\pstFPadd#1#2#3{\pstFP@callc\pstFP@add#1{#2}{#3}+\relax} % #1 := #2+#3 \def\pstFPmul#1#2#3{\pstFP@callc\pstFP@mul#1{#2}{#3}} % #1 := #2*#3 \def\pstFPdiv#1#2#3{\pstFP@callc\pstFP@div#1{#2}{#3}} % #1 := #2/#3 @@ -400,6 +402,80 @@ }% } % +%add two values +\def\pstFP@add#1#2.#3.#4\relax#5.#6.#7\relax#8\relax{% + % #1 macro, which gets the result + % #2 integer part of 1st value + % #3 fractional part of 1st value + % #4 dummy to swallow everthing after the 2nd '.' + % #5 integer part of 2nd value + % #6 fractional part of 2nd value + % #7 dummy to swallow everthing after the 2nd '.' + % + {\ifx#8+\relax% + \pstFP@readvalue{x}{#2}{#3}% + \pstFP@readvalue{y}{#5}{#6}% + \ifnum\pstFP@xs=\pstFP@ys% + \advance\pstFP@xfb\pstFP@yfb% + \advance\pstFP@xfa\pstFP@yfa% + \ifnum\pstFP@xfb<1000000000\relax\else% + \advance\pstFP@xfb-1000000000\relax% + \advance\pstFP@xfa1\relax% + \fi% + \advance\pstFP@xib\pstFP@yib% + \ifnum\pstFP@xfa<1000000000\relax\else% + \advance\pstFP@xfa-1000000000\relax% + \advance\pstFP@xib1\relax% + \fi% + \advance\pstFP@xia\pstFP@yia% + \ifnum\pstFP@xib<1000000000\relax\else% + \advance\pstFP@xib-1000000000\relax% + \advance\pstFP@xia1\relax% + \fi% + \ifnum\pstFP@xia<1000000000\relax\else% + \pstFP@errmessage{Overflow}% + \fi% + \pstFP@store\pstFP@tmp{x}% + \else% + \advance\pstFP@xfb-\pstFP@yfb% + \ifnum\pstFP@xfb<0\relax% + \advance\pstFP@yfa1\relax% + \advance\pstFP@xfb1000000000\relax% + \fi% + \advance\pstFP@xfa-\pstFP@yfa% + \ifnum\pstFP@xfa<0\relax% + \advance\pstFP@yib1\relax% + \advance\pstFP@xfa1000000000\relax% + \fi% + \advance\pstFP@xib-\pstFP@yib% + \ifnum\pstFP@xib<0\relax% + \advance\pstFP@yia1\relax% + \advance\pstFP@xib1000000000\relax% + \fi% + \advance\pstFP@xia-\pstFP@yia% + \ifnum\pstFP@xia<0\relax% + \pstFP@xs=-\pstFP@xs% + \ifnum\pstFP@xfb=0\relax\else% + \advance\pstFP@xfb-1000000000\relax\pstFP@xfb=-\pstFP@xfb% + \advance\pstFP@xfa1\relax% + \fi% + \ifnum\pstFP@xfa=0\relax\else% + \advance\pstFP@xfa-1000000000\relax\pstFP@xfa=-\pstFP@xfa% + \advance\pstFP@xib1\relax% + \fi% + \ifnum\pstFP@xib=0\relax\else% + \advance\pstFP@xib-1000000000\relax\pstFP@xib=-\pstFP@xib% + \advance\pstFP@xia1\relax% + \fi% + \relax\pstFP@xia=-\pstFP@xia% + \fi% + \pstFP@store\pstFP@tmp{x}% + \fi% + \global\let\pstFP@tmp\pstFP@tmp% + }% + \let#1\pstFP@tmp% +} + \def\pstFP@div#1#2.#3.#4\relax#5.#6.#7\relax{% % #1 macro, which gets the result % #2 integer part of 1st value |