diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryfpu.code.tex')
-rw-r--r-- | Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryfpu.code.tex | 225 |
1 files changed, 198 insertions, 27 deletions
diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryfpu.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryfpu.code.tex index 1c985f27d47..3bb41804bdb 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryfpu.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryfpu.code.tex @@ -1,3 +1,23 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% This file is a copy of some part of PGF/Tikz. +%%% It has been copied here to provide : +%%% - compatibility with older PGF versions +%%% - availability of PGF contributions by Christian Feuersaenger +%%% which are necessary or helpful for pgfplots. +%%% +%%% For reasons of simplicity, I have copied the whole file, including own contributions AND +%%% PGF parts. The copyrights are as they appear in PGF. +%%% +%%% Note that pgfplots has compatible licenses. +%%% +%%% This copy has been modified in the following ways: +%%% - nested \input commands have been updated +%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Date of this copy: Di 29. Dez 22:11:16 CET 2009 %%% + + + % Copyright 2008/2009 by Christian Feuersaenger % % This file may be distributed and/or modified @@ -217,7 +237,9 @@ \pgfmathfloat@install\pgfmathe@=\pgfmathfloate@% \pgfmathfloat@install\pgfmathe=\pgfmathfloate@% \pgfmathfloat@install\pgfmathlessthan@=\pgfmathfloatlessthan@% + \pgfmathfloat@install\pgfmathless@=\pgfmathfloatlessthan@% \pgfmathfloat@install\pgfmathgreaterthan@=\pgfmathfloatgreaterthan@% + \pgfmathfloat@install\pgfmathgreater@=\pgfmathfloatgreaterthan@% \pgfmathfloat@install\pgfmathpow@=\pgfmathfloatpow@ \pgfmathfloat@install\pgfmathrand@=\pgfmathfloatrand@ \pgfmathfloat@install\pgfmathrand=\pgfmathfloatrand@ @@ -233,20 +255,20 @@ \pgfmathfloat@install\pgfmathand@=\pgfmathfloatand@ \pgfmathfloat@install\pgfmathor@=\pgfmathfloator@ \pgfmathfloat@install\pgfmathfactorial@=\pgfmathfloatfactorial@ + \pgfmathfloat@install\pgfmathveclen@=\pgfmathfloatveclen@ + \pgfmathfloat@install\pgfmathcosh@=\pgfmathfloatcosh@ + \pgfmathfloat@install\pgfmathsinh@=\pgfmathfloatsinh@ + \pgfmathfloat@install\pgfmathtanh@=\pgfmathfloattanh@ \pgfmathfloat@install@unimplemented{ceil}% \pgfmathfloat@install@unimplemented{frac}% \pgfmathfloat@install@unimplemented{log2}% \pgfmathfloat@install@unimplemented{log10}% - \pgfmathfloat@install@unimplemented{veclen}% \pgfmathfloat@install@unimplemented{equalto}% \pgfmathfloat@install@unimplemented{random}% \pgfmathfloat@install@unimplemented{setseed}% \pgfmathfloat@install@unimplemented{Mod}% \pgfmathfloat@install@unimplemented{real}% \pgfmathfloat@install@unimplemented{notequal}% - \pgfmathfloat@install@unimplemented{sinh}% - \pgfmathfloat@install@unimplemented{cosh}% - \pgfmathfloat@install@unimplemented{tanh}% % \pgfmathfloat@install@unimplemented{atan2}% % \pgfmathfloat@install@unimplemented{height}% % @@ -306,6 +328,9 @@ \pgfmathfloat@defineadapter@for@pgf@two@null@null@ONEARG{hex}% \pgfmathfloat@defineadapter@for@pgf@two@null@null@ONEARG{bin}% \pgfmathfloat@defineadapter@for@pgf@two@null@null@ONEARG{oct}% + \pgfmathfloat@defineadapter@for@pgf@two@null@null@ONEARG{tanh}% + \pgfmathfloat@defineadapter@for@pgf@two@null@null@ONEARG{sinh}% + \pgfmathfloat@defineadapter@for@pgf@two@null@null@ONEARG{cosh}% % % The following methods actually enable the parser to work with % the internal floating point number representation. @@ -329,6 +354,31 @@ \pgfmathfloat@install\pgfmathparse=\pgfmathfloatparse@pgf@two@null@null% }% +\pgfutil@ifundefined{pgfmathdeclarefunction}{% + % BACKWARDS COMPATIBILITY: We have PGF 2.00 : + \def\pgfmathdeclarepseudoconstant#1#2{% + \begingroup + \toks0=\expandafter{\csname pgfmath#1@\endcsname}% + \toks1={\pgfmath@postfunction}% + \xdef\pgfmathfloat@glob@TMP{\the\toks0 \the\toks1 }% + \xdef\pgfmathfloat@glob@TMPb{\the\toks0 }% + \endgroup + \expandafter\let\csname pgfmath@parsefunction@#1\endcsname=\pgfmathfloat@glob@TMP + \expandafter\let\csname pgfmath#1\endcsname=\pgfmathfloat@glob@TMPb + \expandafter\def\csname pgfmath#1@\endcsname{#2}% + }% + \let\pgfmathredeclarepseudoconstant=\pgfmathdeclarepseudoconstant +}{% + \pgfutil@ifundefined{pgfmathdeclarepseudoconstant}{% + \def\pgfmathdeclarepseudoconstant#1#2{\pgfmathdeclarefunction*{#1}{0}{#2}} + }{}% +}% + +\pgfmathdeclarepseudoconstant{inf}{\def\pgfmathresult{inf}} +\pgfmathdeclarepseudoconstant{infty}{\def\pgfmathresult{inf}} +\pgfmathdeclarepseudoconstant{nan}{\def\pgfmathresult{nan}} +\pgfmathdeclarepseudoconstant{NaN}{\def\pgfmathresult{nan}} + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Hacks to the basic level pgf math engine: @@ -482,6 +532,7 @@ \let\pgfmath@basic@subtract@=\pgfmathsubtract@ \let\pgfmath@basic@multiply@=\pgfmathmultiply@ \let\pgfmath@basic@divide@=\pgfmathdivide@ +\let\pgfmath@basic@reciprocal@=\pgfmathreciprocal@ \let\pgfmath@basic@abs@=\pgfmathabs@ \let\pgfmath@basic@round@=\pgfmathround@ \let\pgfmath@basic@rand@=\pgfmathrand@ @@ -523,34 +574,63 @@ } % Compares #1 with #2 and sets \pgfmathresult either to 1.0 or 0.0. % -% It also sets the boolean \ifpgfmathfloatcomparison (globally. +% It also sets the boolean \ifpgfmathfloatcomparison (globally). \def\pgfmathfloatlessthan@#1#2{% %\def\pgfmathfloatlessthan#1#2#3\and#4#5#6{% \global\pgfmathfloatcomparisonfalse \begingroup - \expandafter\pgfmathfloat@decompose#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@M\pgfmathfloat@a@E - \expandafter\pgfmathfloat@decompose#2\relax\pgfmathfloat@b@S\pgfmathfloat@b@M\pgfmathfloat@b@E + \edef\pgfmathfloat@loc@TMPa{#1}% + \edef\pgfmathfloat@loc@TMPb{#2}% + \expandafter\pgfmathfloat@decompose\pgfmathfloat@loc@TMPa\relax\pgfmathfloat@a@S\pgfmathfloat@a@M\pgfmathfloat@a@E + \expandafter\pgfmathfloat@decompose\pgfmathfloat@loc@TMPb\relax\pgfmathfloat@b@S\pgfmathfloat@b@M\pgfmathfloat@b@E \ifcase\pgfmathfloat@a@S % x = 0 -> (x<y <=> y >0) - \ifnum1=\pgfmathfloat@b@S + \ifcase\pgfmathfloat@b@S + % y = 0 + \or% y > 0 \global\pgfmathfloatcomparisontrue + \or% y < 0 + \or% y = nan + \or% y = + infty + \global\pgfmathfloatcomparisontrue + \or% y = -infty \fi \or % x > 0 -> (x<y <=> ( y > 0 && |x| < |y|) ) - \ifnum1=\pgfmathfloat@b@S - % y>0: + \ifcase\pgfmathfloat@b@S + % y = 0 + \or% y>0: \pgfmathfloatlessthan@positive + \or% y < 0 + \or% y = nan + \or% y = + infty + \global\pgfmathfloatcomparisontrue + \or% y = -infty \fi \or % x < 0 -> (x<y <=> (y >= 0 || |x| > |y|) ) - \ifnum2=\pgfmathfloat@b@S - % 'y<0': + \ifcase\pgfmathfloat@b@S + % y = 0 + \global\pgfmathfloatcomparisontrue + \or%y > 0 + \global\pgfmathfloatcomparisontrue + \or% 'y<0': \pgfmathfloatgreaterthan@positive + \or% y = nan + \or% y = + infty + \global\pgfmathfloatcomparisontrue + \or% y = -infty + \fi + \or + % x = nan. + \or + % x = +infty + \or + % x = -infty + \ifnum\pgfmathfloat@b@S=3 \else \global\pgfmathfloatcomparisontrue \fi - \else - \pgfmath@error{Sorry, 'pgfmathfloatlessthan@{#1}{#2}' not yet supported.}{}% \fi \endgroup \ifpgfmathfloatcomparison @@ -736,24 +816,22 @@ % - \pgfmathfloat@a@Mtok : undefined (its contents will be destroyed. % \def\pgfmathfloattoextentedprecision@a#1{% - \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E + \edef\pgfmathresult{#1}% + \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E \ifnum\pgfmathfloat@a@S<3 \advance\pgfmathfloat@a@E by-\pgfmathfloatextprec@shift\relax% compensate for shift \expandafter\pgfmathfloattoextentedprecision@@\the\pgfmathfloat@a@Mtok 000\pgfmathfloat@EOI - \else - \edef\pgfmathresult{#1}% \fi }% % Similar to \pgfmathfloattoextentedprecision@a, this one here fills the '@b' registers. \def\pgfmathfloattoextentedprecision@b#1{% - \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@b@S\pgfmathfloat@a@Mtok\pgfmathfloat@b@E + \edef\pgfmathresult{#1}% + \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@b@S\pgfmathfloat@a@Mtok\pgfmathfloat@b@E \ifnum\pgfmathfloat@b@S<3 \advance\pgfmathfloat@b@E by-\pgfmathfloatextprec@shift\relax \expandafter\pgfmathfloattoextentedprecision@@\the\pgfmathfloat@a@Mtok 00\pgfmathfloat@EOI - \else - \edef\pgfmathresult{#1}% \fi }% @@ -810,8 +888,40 @@ % #2= TeX code to execute if #1 == 0 % #3= TeX code to execute if #1 != 0 \def\pgfmathfloatifzero#1#2#3{% - \expandafter\pgfmathfloat@decompose@F#1\relax\pgfmathfloat@a@S - \ifnum\pgfmathfloat@a@S=0 #2\else#3\fi + \pgfmathfloatgetflagstomacro{#1}\pgfmathfloat@loc@TMPa + \if\pgfmathfloat@loc@TMPa0 #2\else#3\fi +}% + +\def\pgfmathfloatiffinite#1#2#3{% + \pgfmathfloatgetflagstomacro{#1}\pgfmathfloatiffinite@ + \ifnum\pgfmathfloatiffinite@>2 #3\else #2\fi +}% + +% Invokes code '#3' if the flags of the floating point number '#1' +% match the flag provided in '#2'. +% +% \pgfmathfloatcreate{1}{1.0}{2} +% \pgfmathfloatifflags{\pgfmathresult}{0}{It's zero!}{It's not zero!}% +% \pgfmathfloatifflags{\pgfmathresult}{1}{It's positive!}{It's not positive!}% +% \pgfmathfloatifflags{\pgfmathresult}{2}{It's negative!}{It's not negative!}% +% or, equivalently +% \pgfmathfloatifflags{\pgfmathresult}{+}{It's positive!}{It's not positive!}% +% \pgfmathfloatifflags{\pgfmathresult}{-}{It's negative!}{It's not negative!}% +\def\pgfmathfloatifflags#1#2#3#4{% + \if#2-% + \pgfmathfloatifflags{#1}{2}{#3}{#4}% + \else + \if#2+% + \pgfmathfloatifflags{#1}{1}{#3}{#4}% + \else + \pgfmathfloatgetflagstomacro#1\pgfmathfloat@loc@TMPa + \if\pgfmathfloat@loc@TMPa#2 + #3\relax + \else + #4\relax + \fi + \fi + \fi }% % #1=mantisse which needs to be shifted (with smaller exponent) @@ -857,7 +967,8 @@ % Subtracts two floating point numbers. \def\pgfmathfloatsubtract@#1#2{% \begingroup - \expandafter\pgfmathfloat@decompose@tok#2\relax\pgfmathfloat@b@S\pgfmathfloat@a@Mtok\pgfmathfloat@b@E + \edef\pgfmathresult{#2}% + \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@b@S\pgfmathfloat@a@Mtok\pgfmathfloat@b@E \ifcase\pgfmathfloat@b@S \edef\pgfmathresult{#1}% \or @@ -914,12 +1025,10 @@ \def\pgfmathfloatmultiply@#1#2{% \begingroup \pgfmathfloatsetextprecision{1}% - \edef\pgfmathfloat@arga{#1}% - \pgfmathfloattoextentedprecision@a{\pgfmathfloat@arga}% + \pgfmathfloattoextentedprecision@a{#1}% \let\pgfmathfloat@arga=\pgfmathresult % - \edef\pgfmathfloat@argb{#2}% - \pgfmathfloattoextentedprecision@b{\pgfmathfloat@argb}% + \pgfmathfloattoextentedprecision@b{#2}% \let\pgfmathfloat@argb=\pgfmathresult % \pgfmathfloatcomparisontrue% re-use this boolean here to handle special cases. @@ -1764,4 +1873,66 @@ \pgfmath@smuggleone\pgfmathresult \endgroup }% + +% Implements the vector length of a 2D vector. +% +% ATTENTION: this does NOT use the improved code of the basic layer! +% It simply computed sqrt( #1^2 + #2^2 )! +\def\pgfmathfloatveclen@#1#2{% + \begingroup + \edef\pgfmathfloat@@a{#1}% + \pgfmathfloatmultiply@{\pgfmathfloat@@a}{\pgfmathfloat@@a}% + \let\pgfmathfloat@@a=\pgfmathresult + % + \edef\pgfmathfloat@@b{#2}% + \pgfmathfloatmultiply@{\pgfmathfloat@@b}{\pgfmathfloat@@b}% + \let\pgfmathfloat@@b=\pgfmathresult + % + \pgfmathfloatadd@{\pgfmathfloat@@a}{\pgfmathfloat@@b}% + \pgfmathfloatsqrt@{\pgfmathresult}% + \pgfmath@smuggleone\pgfmathresult + \endgroup +}% + +\def\pgfmathfloatcosh@#1{% + \begingroup + \pgfmathfloatexp@{#1}% + \let\pgfmathfloat@@a=\pgfmathresult + % + \pgfmathfloatneg@{#1}% + \pgfmathfloatexp@{\pgfmathresult}% + % + \pgfmathfloatadd@{\pgfmathresult}{\pgfmathfloat@@a}% + \expandafter\pgfmathfloatmultiplyfixed@\expandafter{\pgfmathresult}{0.5}% + % + \pgfmath@smuggleone\pgfmathresult + \endgroup +}% +\def\pgfmathfloatsinh@#1{% + \begingroup + \pgfmathfloatexp@{#1}% + \let\pgfmathfloat@@a=\pgfmathresult + % + \pgfmathfloatneg@{#1}% + \pgfmathfloatexp@{\pgfmathresult}% + % + \pgfmathfloatsubtract@{\pgfmathfloat@@a}{\pgfmathresult}% + \expandafter\pgfmathfloatmultiplyfixed@\expandafter{\pgfmathresult}{0.5}% + % + \pgfmath@smuggleone\pgfmathresult + \endgroup +}% +\def\pgfmathfloattanh@#1{% + \begingroup + \pgfmathfloatsinh@{#1}% + \let\pgfmathfloat@@a=\pgfmathresult + % + \pgfmathfloatcosh@{#1}% + \let\pgfmathfloat@@b=\pgfmathresult + % + \pgfmathfloatdivide@{\pgfmathfloat@@a}{\pgfmathfloat@@b}% + % + \pgfmath@smuggleone\pgfmathresult + \endgroup +}% \endinput |