summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2009-02-05 01:04:42 +0000
committerKarl Berry <karl@freefriends.org>2009-02-05 01:04:42 +0000
commitad23c1c436c3e031cc4b81849d0fa2b892851467 (patch)
treed04be182dbf5cdb14c1728b8f2edddc84f77df03 /Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib
parent4041df693bc0b66ecdf77e891e5ff1a60f1497fc (diff)
pgfplots update (4feb09)
git-svn-id: svn://tug.org/texlive/trunk@12087 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib')
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_loader.code.tex41
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_misc.code.tex7
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryfpu.code.tex1767
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex2
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmathfloat.code.tex1429
5 files changed, 2257 insertions, 989 deletions
diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_loader.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_loader.code.tex
index ce780e866b2..6d89fd79532 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_loader.code.tex
+++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_loader.code.tex
@@ -1,12 +1,29 @@
-%--------------------------------------------------
-% \pgfutil@ifundefined{pgfmathfloattosci}
-% {}%
-% {\endinput}%
-%--------------------------------------------------
-\pgfkeysifdefined{/pgf/number format/@dec sep mark}{\endinput}{}
-
-\immediate\write16{Package pgfplots: loading complementary code for your PGF version...}
-\input pgfplotsoldpgfsupp_misc.code.tex
-\input pgfplotsoldpgfsupp_pgfkeysfiltered.code.tex
-\input pgfplotsoldpgfsupp_pgfmathfloat.code.tex
-\input pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex
+
+\pgfutil@ifundefined{pgfmathlessthan@}{%
+ \let\pgfmathlessthan@=\pgfmathless@
+ \let\pgfmathgreaterthan@=\pgfmathgreater@
+}{}%
+
+
+% check whether we need to load supplementary code.
+% The development of pgfplots and pgf is intermingled, so pgfplots
+% always uses up-to-date pgf CVS versions - the relevant complements between
+% PGF 2.00 and PGF CVS are loaded here:
+\pgfutil@ifundefined{pgfmathfloatparsenumber@handleerror}{%
+ %\pgfkeysifdefined{/pgf/number format/min exponent for 1000 sep}{\endinput}{}
+ \immediate\write16{Package pgfplots: loading complementary code for your PGF version...}
+ \input pgfplotsoldpgfsupp_misc.code.tex
+ \input pgfplotsoldpgfsupp_pgfkeysfiltered.code.tex
+ \input pgfplotsoldpgfsupp_pgfmathfloat.code.tex
+ \input pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex
+}
+ {\relax}
+
+\pgfplots@iffileexists{pgflibraryfpu.code.tex}{%
+ \usepgflibrary{fpu}%
+}{%
+ \immediate\write16{Package pgfplots: loading FPU library which doesn't appear to exist in your PGF version...}
+ \input pgfplotsoldpgfsupp_pgflibraryfpu.code.tex
+}%
+
+\endinput
diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_misc.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_misc.code.tex
index def32476da4..8911ac2f14b 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_misc.code.tex
+++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_misc.code.tex
@@ -91,6 +91,13 @@
\tikzoption{jump mark right}[]{\let\tikz@plot@handler=\pgfplothandlerjumpmarkright}
\tikzoption{jump mark left}[]{\let\tikz@plot@handler=\pgfplothandlerjumpmarkleft}
+\tikzoption{mark}{
+ \def\tikz@plot@mark{#1}%
+ \def\tikz@temp{none}% this check is relatively new
+ \ifx\tikz@temp\tikz@plot@mark
+ \let\tikz@plot@mark=\pgfutil@empty
+ \fi
+}
% the 'every mark' style is new:
\tikzset{
every mark/.style={},
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
new file mode 100644
index 00000000000..1c985f27d47
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryfpu.code.tex
@@ -0,0 +1,1767 @@
+% Copyright 2008/2009 by Christian Feuersaenger
+%
+% This file may be distributed and/or modified
+%
+% 1. under the LaTeX Project Public License and/or
+% 2. under the GNU General Public License.
+%
+% See the file doc/generic/pgf/licenses/LICENSE for more details.
+
+\newif\ifpgfmathfloatparseactive
+\newif\ifpgfmathfloat@scaleactive
+
+% public macro which invokes '#1' if the fpu is installed and ready and '#2'
+% otherwise.
+\def\pgflibraryfpuifactive#1#2{%
+ \ifpgfmathfloatparseactive
+ #1%
+ \else
+ #2%
+ \fi
+}%
+
+\pgfqkeys{/pgf}{
+ % enable the FPU parser if it is not yet active
+ %
+ % It will be deactivated after the current TeX group
+ fpu/.is choice,
+ fpu/true/.code={%
+ \ifpgfmathfloatparseactive
+ \else
+ \pgfutil@ifundefined{pgfmathdeclarefunction}{%
+ % Ohoh - we are running on a TeX distribution with
+ % PGF 2.00 which doesn't have the new math engine.
+ % I can provide special treatment here, provided that
+ % all float commands are still able to run (that means
+ % more information needs to be copied from the pgf cvs
+ % to pgf 2.00 - for example pgfmathfloat.code.tex).
+ %
+ % I employ this to work with pgfplots and pgf 2.00
+ % using all new features.
+ \pgfmathfloat@parser@install@pgf@two@null@null%
+ }{%
+ \pgfmathfloat@parser@install%
+ }%
+ \pgfmathfloatparseactivetrue
+ % improve compatibility with Marks FP library:
+ \pgfkeysalso{/pgf/fixed point arithmetic/.prefix style={/pgf/fpu=false}}%
+ \fi
+ },%
+ fpu/false/.code={%
+ \ifpgfmathfloatparseactive
+ \pgfmathfloat@uninstall%
+ \pgfmathfloatparseactivefalse
+ \fi
+ },%
+ fpu/.default=true,
+ % Use this to introduce a result scaling.
+ % Every expression in which the prefix '*' occurs
+ % will be multiplied with the result and converted to fixed point
+ % representation.
+ fpu/scale results/.code={%
+ \ifpgfmathfloatparseactive
+ \pgfmathparse{#1}%
+ \else
+ \pgfmathfloatparsenumber{#1}%
+ \fi
+ \let\pgfmathfloatscale=\pgfmathresult%
+ },%
+ % determines the output format of each complete expression parsing
+ % process. If 'scale results' is active, 'fixed' is assumed
+ % automatically.
+ fpu/output format/.is choice,
+ fpu/output format/float/.code= {\let\pgfmathfloatparse@output=\relax},
+ fpu/output format/sci/.code= {\def\pgfmathfloatparse@output{\pgfmathfloattosci@{\pgfmathresult}}},
+ fpu/output format/fixed/.code= {\def\pgfmathfloatparse@output{\pgfmathfloattofixed@{\pgfmathresult}}},
+ fpu/output format/float,
+}
+
+\pgfmathfloatcreate{1}{1.0}{0}\let\pgfmathfloatscale=\pgfmathresult
+
+% This is the replacement parser invocation.
+% It does two things which are different to \pgfmathparse:
+% 1. it disables any dimension dependand scalings,
+% 2. it implements the 'scale results' feature.
+\def\pgfmathfloatparse{%
+ \begingroup%
+ % disable any dimension-dependant scalings:
+ \let\pgfmathpostparse=\relax%
+ \pgfmath@catcodes%
+ \pgfmath@quickparsefalse%
+ \pgfmathfloatparse@}
+
+% for pgf 2.00 :
+\def\pgfmathfloatparse@pgf@two@null@null{%
+ \pgfmath@quickparsefalse%
+ \pgfmathfloatparse@}
+
+\def\pgfmathfloatparse@#1{%
+ \edef\pgfmathfloat@expression{#1}%
+ \expandafter\pgfmathfloatparse@@\pgfmathfloat@expression\pgfmathfloat@
+ \ifpgfmathfloat@scaleactive
+ \expandafter\pgfmathfloatmultiply@\expandafter{\pgfmathresult}{\pgfmathfloatscale}
+ \pgfmathfloattofixed{\pgfmathresult}%
+ \else
+ \pgfmathfloatparse@output
+ \fi
+}
+
+\def\pgfmathfloat@char@asterisk{*}
+\def\pgfmathfloatparse@@#1#2\pgfmathfloat@{%
+ \def\pgfmathfloat@test{#1}%
+ \ifx\pgfmathfloat@test\pgfmathfloat@char@asterisk%
+ \def\pgfmathfloat@expression{#2}%
+ \pgfmathfloat@scaleactivetrue
+ \fi%
+ \expandafter\pgfmathparse@\expandafter{\pgfmathfloat@expression}%
+ % \endgroup provided by \pgfpathmarse@end
+}
+
+% Crude handling of file plots
+%
+\pgfkeys{/pgf/fpu/.cd,
+ scale file plot x/.code=\pgfmathfloatparse{#1}\edef\pgfmathfloatplotscalex{\pgfmathresult*},
+ scale file plot y/.code=\pgfmathfloatparse{#1}\edef\pgfmathfloatplotscaley{\pgfmathresult*},
+ scale file plot z/.code=\pgfmathfloatparse{#1}\edef\pgfmathfloatplotscalez{\pgfmathresult*}
+}
+
+\def\pgfmathfloat@uninstall@appendcmd#1{%
+ \expandafter\gdef\expandafter\pgfmathfloat@uninstall\expandafter{\pgfmathfloat@uninstall #1}%
+}%
+
+% If the uninstall command is already assembled, it will skip the
+% uninstall assemblation.
+\def\pgfmathfloat@plots@checkuninstallcmd{%
+ \pgfutil@ifundefined{pgfmathfloat@uninstall}{%
+ \global\let\pgfmathfloat@uninstall=\pgfutil@empty
+ }{%
+ % We already HAVE an uninstall command (prepared globally).
+ % So: don't waste time assembling one!
+ \def\pgfmathfloat@uninstall@appendcmd##1{}%
+ \def\pgfmathfloat@prepareuninstallcmd##1{}%
+ }%
+}%
+
+% This assembles an uninstall command globally ON FIRST USAGE.
+% See \pgfmathfloat@plots@checkuninstallcmd
+\def\pgfmathfloat@prepareuninstallcmd#1{%
+ % and store backup information (globally - I don't want to do that
+ % all the time when the FPU is used!):
+ \expandafter\global\expandafter\let\csname pgfmathfloat@backup@\string#1\endcsname=#1%
+ \expandafter\gdef\expandafter\pgfmathfloat@uninstall\expandafter{\pgfmathfloat@uninstall
+ \expandafter\let\expandafter#1\csname pgfmathfloat@backup@\string#1\endcsname%
+ }%
+}
+
+\def\pgfmathfloat@install#1=#2{%
+ \pgfmathfloat@prepareuninstallcmd{#1}%
+ \let#1=#2%
+}
+\def\pgfmathfloat@install@unimplemented#1{%
+ \expandafter\pgfmathfloat@prepareuninstallcmd\csname pgfmath@#1@\endcsname%
+ \expandafter\def\csname pgfmath#1@\endcsname##1{\pgfmathfloat@notimplemented{#1}}%
+}
+\def\pgfmathfloat@plots@install{%
+ \let\pgfmathfloatplotscalex=\pgfutil@empty
+ \let\pgfmathfloatplotscaley=\pgfutil@empty
+ \let\pgfmathfloatplotscalez=\pgfutil@empty
+ \pgfmathfloat@install\pgf@parsexyline=\pgfmathfloat@parsexyline%
+ \pgfmathfloat@install\pgf@parsexyzline=\pgfmathfloat@parsexyzline%
+}
+\def\pgfmathfloat@parsexyline#1 #2 #3\pgf@stop{%
+ \edef\pgfmathfloat@marshal{%
+ \noexpand\pgfplotstreampoint{\noexpand\pgfpointxy{\pgfmathfloatplotscalex#1}{\pgfmathfloatplotscaley#2}}%
+ }%
+ \pgfmathfloat@marshal%
+}
+\def\pgfmathfloat@parsexyzline#1 #2 #3 #4\pgf@stop{%
+ \edef\pgfmathfloat@marshal{%
+ \noexpand\pgfplotstreampoint{%
+ \noexpand\pgfpointxyz{\pgfmathfloatplotscalex#1}{\pgfmathfloatplotscaley#2}{\pgfmathfloatplotscalez#3}%
+ }%
+ }%
+ \pgfmathfloat@marshal%
+}
+
+%
+\def\pgfmathfloat@parser@install@functions{%
+ % Install float commands...
+ %
+ \pgfmathfloat@install\pgfmathadd@=\pgfmathfloatadd@%
+ \pgfmathfloat@install\pgfmathsubtract@=\pgfmathfloatsubtract@%
+ \pgfmathfloat@install\pgfmathneg@=\pgfmathfloatneg@%
+ \pgfmathfloat@install\pgfmathmultiply@=\pgfmathfloatmultiply@%
+ \pgfmathfloat@install\pgfmathdivide@=\pgfmathfloatdivide@%
+ \pgfmathfloat@install\pgfmathabs@=\pgfmathfloatabs@%
+ \pgfmathfloat@install\pgfmathround@=\pgfmathfloatround@%
+ \pgfmathfloat@install\pgfmathfloor@=\pgfmathfloatfloor@%
+ \pgfmathfloat@install\pgfmathmod@=\pgfmathfloatmod@%
+ \pgfmathfloat@install\pgfmathmax@=\pgfmathfloatmax@%
+ \pgfmathfloat@install\pgfmathmin@=\pgfmathfloatmin@%
+ \pgfmathfloat@install\pgfmathsin@=\pgfmathfloatsin@%
+ \pgfmathfloat@install\pgfmathcos@=\pgfmathfloatcos@%
+ \pgfmathfloat@install\pgfmathtan@=\pgfmathfloattan@%
+ \pgfmathfloat@install\pgfmathdeg@=\pgfmathfloatdeg@%
+ \pgfmathfloat@install\pgfmathrad@=\pgfmathfloatrad@%
+ \pgfmathfloat@install\pgfmathatan@=\pgfmathfloatatan@%
+ \pgfmathfloat@install\pgfmathasin@=\pgfmathfloatasin@%
+ \pgfmathfloat@install\pgfmathacos@=\pgfmathfloatacos@%
+ \pgfmathfloat@install\pgfmathcot@=\pgfmathfloatcot@%
+ \pgfmathfloat@install\pgfmathsec@=\pgfmathfloatsec@%
+ \pgfmathfloat@install\pgfmathcosec@=\pgfmathfloatcosec@%
+ \pgfmathfloat@install\pgfmathexp@=\pgfmathfloatexp@%
+ \pgfmathfloat@install\pgfmathln@=\pgfmathfloatln@%
+ \pgfmathfloat@install\pgfmathsqrt@=\pgfmathfloatsqrt@%
+ \pgfmathfloat@install\pgfmath@pi=\pgfmathfloatpi@%
+ \pgfmathfloat@install\pgfmathpi=\pgfmathfloatpi@%
+ \pgfmathfloat@install\pgfmathe@=\pgfmathfloate@%
+ \pgfmathfloat@install\pgfmathe=\pgfmathfloate@%
+ \pgfmathfloat@install\pgfmathlessthan@=\pgfmathfloatlessthan@%
+ \pgfmathfloat@install\pgfmathgreaterthan@=\pgfmathfloatgreaterthan@%
+ \pgfmathfloat@install\pgfmathpow@=\pgfmathfloatpow@
+ \pgfmathfloat@install\pgfmathrand@=\pgfmathfloatrand@
+ \pgfmathfloat@install\pgfmathrand=\pgfmathfloatrand@
+ \pgfmathfloat@install\pgfmathrnd@=\pgfmathfloatrnd@
+ \pgfmathfloat@install\pgfmathrnd=\pgfmathfloatrnd
+ \pgfmathfloat@install\pgfmathtrue@=\pgfmathfloattrue@
+ \pgfmathfloat@install\pgfmathfalse@=\pgfmathfloatfalse@
+ \pgfmathfloat@install\pgfmathnot@=\pgfmathfloatnot@
+ \pgfmathfloat@install\pgfmathhex@=\pgfmathfloathex@
+ \pgfmathfloat@install\pgfmathHex@=\pgfmathfloatHex@
+ \pgfmathfloat@install\pgfmathoct@=\pgfmathfloatoct@
+ \pgfmathfloat@install\pgfmathbin@=\pgfmathfloatbin@
+ \pgfmathfloat@install\pgfmathand@=\pgfmathfloatand@
+ \pgfmathfloat@install\pgfmathor@=\pgfmathfloator@
+ \pgfmathfloat@install\pgfmathfactorial@=\pgfmathfloatfactorial@
+ \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}%
+ %
+ %
+ \pgfmathfloat@install\pgfmathscientific=\pgfmathfloatscientific%
+}
+
+\def\pgfmathfloat@parser@install{%
+ \pgfmathfloat@plots@checkuninstallcmd
+ \pgfmathfloat@plots@install%
+ \pgfmathfloat@parser@install@functions
+ %
+ %
+ %
+ % The following methods actually enable the parser to work with
+ % the internal floating point number representation.
+ %
+ % The idea is as follows:
+ % 1. Every operand must be given in internal float representation.
+ % 2. The internal float repr can be distinguished by a normal
+ % number. This is accomplished by introducing a new "exponent"
+ % token.
+ % 3. The stack-push-operation checks whether the argument is a
+ % float. If not, it is parsed properly before pushing it.
+ \pgfmath@tokens@make{exponent}{\pgfmathfloat@POSTFLAGSCHAR}%
+ \pgfmathfloat@uninstall@appendcmd{%
+ \expandafter\let\csname pgfmath@token@exponent@\pgfmathfloat@POSTFLAGSCHAR\endcsname=\relax
+ }%
+ \let\pgfmath@basic@parse@exponent=\pgfmath@parse@exponent%
+ \let\pgfmath@basic@stack@push@operand=\pgfmath@stack@push@operand
+ \pgfmathfloat@install\pgfmath@stack@push@operand=\pgfmathfloat@stack@push@operand
+ \pgfmathfloat@install\pgfmath@parse@exponent=\pgfmathfloat@parse@float@or@exponent
+ %
+ \pgfmathfloat@install\pgfmathparse=\pgfmathfloatparse%
+}%
+
+\def\pgfmathfloat@defineadapter@for@pgf@two@null@null@ONEARG#1{%
+ \edef\pgfmathfloat@loc@TMPa{%
+ \noexpand\def\expandafter\noexpand\csname pgfmath@parsefunction@#1\endcsname{%
+ \noexpand\let\noexpand\pgfmath@parsepostgroup\expandafter\noexpand\csname pgfmath@parsefunction@#1@\endcsname%
+ \noexpand\expandafter\noexpand\pgfmath@parse@}%
+ \noexpand\def\expandafter\noexpand\csname pgfmath@parsefunction@#1@\endcsname{%
+ \noexpand\expandafter\expandafter\noexpand\csname pgfmath#1@\endcsname\noexpand\expandafter{\noexpand\pgfmathresult}%
+ \noexpand\pgfmath@postfunction%
+ }%
+ }%
+ \pgfmathfloat@loc@TMPa
+}%
+\def\pgfmathfloat@parser@install@pgf@two@null@null{%
+ \pgfmathfloat@plots@checkuninstallcmd
+ \pgfmathfloat@plots@install%
+ \pgfmathfloat@parser@install@functions
+ \let\pgfmathrand@=\pgfmath@basic@rand@
+ \pgfmathfloat@install\pgfmathmax@=\pgfmathfloatmaxtwo%
+ \pgfmathfloat@install\pgfmathmin@=\pgfmathfloatmintwo%
+ \pgfmathfloat@defineadapter@for@pgf@two@null@null@ONEARG{factorial}%
+ \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}%
+ %
+ % The following methods actually enable the parser to work with
+ % the internal floating point number representation.
+ %
+ % The idea is as follows:
+ % 1. Every operand must be given in internal float representation.
+ % 2. The internal float repr can be distinguished by a normal
+ % number. This is accomplished by introducing a new "exponent"
+ % token.
+ % 3. The stack-push-operation checks whether the argument is a
+ % float. If not, it is parsed properly before pushing it.
+ \let\pgfmath@basic@parsedecimalpoint=\pgfmath@parsedecimalpoint%
+ \let\pgfmath@basic@stack@push@operand=\pgfmath@stackpushoperand
+ \pgfmathfloat@install\pgfmath@stackpushoperand=\pgfmathfloat@stack@push@operand
+ \pgfmathfloat@install\pgfmath@parsedecimalpoint=\pgfmathfloat@parsedecimalpoint@pgf@two@null@null
+ \pgfmathfloat@install\pgfmath@endparse=\pgfmathfloat@endparse@pgf@two@null@null
+ \pgfmathfloat@install\pgfmath@endparsegroup=\pgfmathfloat@endparsegroup@pgf@two@null@null
+ \pgfmathfloat@install\pgfmath@postfunction=\pgfmathfloat@postfunction@pgf@two@null@null
+ \pgfmathfloat@install\pgfmath@@parseoperandgroup=\pgfmathfloat@@parseoperandgroup
+ %
+ \pgfmathfloat@install\pgfmathparse=\pgfmathfloatparse@pgf@two@null@null%
+}%
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% Hacks to the basic level pgf math engine:
+%
+% WARNING: These methods rely heavily on the internal float representation!
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+% for pgf2.00 :
+\def\pgfmathfloat@parsedecimalpoint@pgf@two@null@null#1{%
+ \expandafter\ifx\pgfmathfloat@POSTFLAGSCHAR#1% check whether it is a float
+ \let\pgfmath@next=\pgfmathfloat@return@float@pgf@two@null@null%
+ \else
+ \def\pgfmath@next{\pgfmath@basic@parsedecimalpoint#1}%
+ \fi
+ \pgfmath@next
+}
+% for pgf2.00:
+\def\pgfmathfloat@return@float@pgf@two@null@null#1]{%
+ \edef\pgfmathresult{\the\c@pgfmath@parsecounta\pgfmathfloat@POSTFLAGSCHAR#1]}%
+ \let\pgfmath@resulttemp=\pgfmathresult
+ \pgfmath@parseoperator%
+}%
+% for pgf2.00:
+\def\pgfmathfloat@endparse@pgf@two@null@null#1\pgfmath@empty{%
+ \pgfmath@processalloperations%
+ \pgfmath@stackpop{\pgfmathresult}%
+ % delete the final unit scalings
+ \pgfmath@smuggleone{\pgfmathresult}%
+ \endgroup%
+ \ignorespaces%
+}
+% for pgf2.00:
+\def\pgfmathfloat@endparsegroup@pgf@two@null@null{%
+ \pgfmath@processalloperations%
+ \pgfmath@stackpop{\pgfmathresult}%
+ % eliminated register usage here...
+ \pgfmath@smuggleone{\pgfmathresult}%
+ \endgroup%
+ \pgfmath@parsepostgroup%
+}
+% for pgf2.00:
+\def\pgfmathfloat@postfunction@pgf@two@null@null{%
+ \let\pgfmath@parsepostgroup\pgfmath@parseoperator%
+ \ifnum\pgfmath@sign1<0
+ \pgfmathfloatneg@{\pgfmathresult}%
+ \let\pgfmath@sign\pgfutil@empty
+ \fi
+ \pgfmath@parseoperator}
+% for pgf2.00:
+\def\pgfmathfloat@@parseoperandgroup{%
+ \let\pgfmath@postparsegroup\pgfmath@parseoperator%
+ \ifnum\pgfmath@sign1<0
+ \pgfmathfloatneg@{\pgfmathresult}%
+ \let\pgfmath@sign\pgfutil@empty
+ \fi
+ \pgfmath@parseoperator%
+}
+
+
+
+
+
+
+% PRECONDITION:
+% either
+% <number>e
+% ^
+% -> read the exponent.
+% or
+% <sign>\pgfmathfloat@POSTFLAGSCHAR
+% ^
+% -> we have a parsed floating point number -> read it.
+\def\pgfmathfloat@parse@float@or@exponent{%
+ \if\pgfmath@token \pgfmathfloat@POSTFLAGSCHAR%
+ % Ok, we actually HAVE a pre-parsed floating point number!
+ % Return it.
+ \expandafter\pgfmathfloat@return@float\expandafter\pgfmath@token@next
+ \else
+ % We have a standard number in scientific format. Parse it.
+ \expandafter\pgfmath@basic@parse@exponent
+ \fi
+}%
+\def\pgfmathfloat@return@float#1]{%
+ \edef\pgfmathresult{\pgfmath@number \pgfmathfloat@POSTFLAGSCHAR#1]}%
+ \expandafter\pgfmath@basic@stack@push@operand\expandafter{\pgfmathresult}%
+ \pgfmath@parse@@operator%
+}%
+
+% This extends the functionality of the basic level operand stack: it
+% assures every element on the stack is a float.
+\def\pgfmathfloat@stack@push@operand#1{%
+ \pgfutil@ifnextchar\bgroup{%
+ \let\pgfmathfloat@stack@push@operand@list@=\pgfutil@empty
+ \pgfmathfloat@stack@push@operand@list
+ }{%
+ \pgfmathfloat@stack@push@operand@single
+ }%
+ #1\relax
+}%
+\def\pgfmathfloat@stack@push@operand@single#1\relax{%
+ \expandafter\pgfutil@in@\pgfmathfloat@POSTFLAGSCHAR{#1}%
+ \ifpgfutil@in@
+ \pgfmath@basic@stack@push@operand{#1}%
+ \else
+ \pgfmathfloatparsenumber{#1}%
+ \expandafter\pgfmath@basic@stack@push@operand\expandafter{\pgfmathresult}%
+ \fi
+}%
+\def\pgfmathfloat@stack@push@operand@GOBBLE#1\relax{}%
+\def\pgfmathfloat@stack@push@operand@list#1{%
+ \expandafter\pgfutil@in@ \pgfmathfloat@POSTFLAGSCHAR{#1}%
+ \ifpgfutil@in@
+ \expandafter\def\expandafter\pgfmathfloat@stack@push@operand@list@\expandafter{%
+ \pgfmathfloat@stack@push@operand@list@{#1}%
+ }%
+ \else
+ \pgfmathfloatparsenumber{#1}%
+ \begingroup
+ \toks0=\expandafter{\pgfmathfloat@stack@push@operand@list@}%
+ \toks1=\expandafter{\pgfmathresult}%
+ \xdef\pgfmathfloat@glob@TMP{\the\toks0 {\the\toks1}}%
+ \endgroup
+ \let\pgfmathfloat@stack@push@operand@list@=\pgfmathfloat@glob@TMP
+ \fi
+ \pgfutil@ifnextchar\relax{%
+ \expandafter\pgfmath@basic@stack@push@operand\expandafter{\pgfmathfloat@stack@push@operand@list@}%
+ \pgfmathfloat@stack@push@operand@GOBBLE
+ }{%
+ \pgfmathfloat@stack@push@operand@list
+ }%
+}%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% --- END --- Hacks to the basic level pgf math engine
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% Here starts the implementation of the floating point
+% routines.
+%
+% They can be used even if the FPU parser is not active.
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+% Remember the basic math commands. They will be invoked as subroutines in floating point routines.
+\let\pgfmath@basic@add@=\pgfmathadd@
+\let\pgfmath@basic@subtract@=\pgfmathsubtract@
+\let\pgfmath@basic@multiply@=\pgfmathmultiply@
+\let\pgfmath@basic@divide@=\pgfmathdivide@
+\let\pgfmath@basic@abs@=\pgfmathabs@
+\let\pgfmath@basic@round@=\pgfmathround@
+\let\pgfmath@basic@rand@=\pgfmathrand@
+\let\pgfmath@basic@rnd@=\pgfmathrnd@
+\let\pgfmath@basic@setseed@=\pgfmathsetseed@
+\let\pgfmath@basic@random@=\pgfmathrandom@
+\let\pgfmath@basic@floor@=\pgfmathfloor@
+\let\pgfmath@basic@ceil@=\pgfmathceil@
+\let\pgfmath@basic@mod@=\pgfmathmod@
+\let\pgfmath@basic@max@=\pgfmathmax@
+\let\pgfmath@basic@min@=\pgfmathmin@
+\let\pgfmath@basic@sin@=\pgfmathsin@
+\let\pgfmath@basic@cos@=\pgfmathcos@
+\let\pgfmath@basic@tan@=\pgfmathtan@
+\let\pgfmath@basic@deg@=\pgfmathdeg@
+\let\pgfmath@basic@rad@=\pgfmathrad@
+\let\pgfmath@basic@atan@=\pgfmathatan@
+\let\pgfmath@basic@asin@=\pgfmathasin@
+\let\pgfmath@basic@acos@=\pgfmathacos@
+\let\pgfmath@basic@cot@=\pgfmathcot@
+\let\pgfmath@basic@sec@=\pgfmathsec@
+\let\pgfmath@basic@cosec@=\pgfmathcosec@
+\let\pgfmath@basic@pow@=\pgfmathpow@
+\let\pgfmath@basic@exp@=\pgfmathexp@
+\let\pgfmath@basic@ln@=\pgfmathln@
+\let\pgfmath@basic@sqrt@=\pgfmathsqrt@
+\let\pgfmath@basic@@pi=\pgfmath@pi
+\let\pgfmath@basic@veclen@=\pgfmathveclen@
+\let\pgfmath@basic@e@=\pgfmathe@
+\let\pgfmath@basic@lessthan@=\pgfmathlessthan@
+\let\pgfmath@basic@greaterthan@=\pgfmathgreaterthan@
+\let\pgfmath@basic@equalto@=\pgfmathequalto@
+\let\pgfmath@basic@true@=\pgfmathtrue@
+\let\pgfmath@basic@false@=\pgfmathfalse@
+
+\def\pgfmathfloatscientific#1#2{%
+ \edef\pgfmathresult{#1e#2}%
+ \expandafter\pgfmathfloatparsenumber\expandafter{\pgfmathresult}%
+}
+% Compares #1 with #2 and sets \pgfmathresult either to 1.0 or 0.0.
+%
+% 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
+ \ifcase\pgfmathfloat@a@S
+ % x = 0 -> (x<y <=> y >0)
+ \ifnum1=\pgfmathfloat@b@S
+ \global\pgfmathfloatcomparisontrue
+ \fi
+ \or
+ % x > 0 -> (x<y <=> ( y > 0 && |x| < |y|) )
+ \ifnum1=\pgfmathfloat@b@S
+ % y>0:
+ \pgfmathfloatlessthan@positive
+ \fi
+ \or
+ % x < 0 -> (x<y <=> (y >= 0 || |x| > |y|) )
+ \ifnum2=\pgfmathfloat@b@S
+ % 'y<0':
+ \pgfmathfloatgreaterthan@positive
+ \else
+ \global\pgfmathfloatcomparisontrue
+ \fi
+ \else
+ \pgfmath@error{Sorry, 'pgfmathfloatlessthan@{#1}{#2}' not yet supported.}{}%
+ \fi
+ \endgroup
+ \ifpgfmathfloatcomparison
+ \def\pgfmathresult{1.0}%
+ \else
+ \def\pgfmathresult{0.0}%
+ \fi
+}
+\let\pgfmathfloatlessthan=\pgfmathfloatlessthan@
+
+% compares \pgfmathfloat@a@[SME] < \pgfmathfloat@b@[SME]
+\def\pgfmathfloatlessthan@positive{%
+ \ifnum\pgfmathfloat@a@E<\pgfmathfloat@b@E
+ \global\pgfmathfloatcomparisontrue
+ \else
+ \ifnum\pgfmathfloat@a@E=\pgfmathfloat@b@E
+ \ifdim\pgfmathfloat@a@M<\pgfmathfloat@b@M
+ \global\pgfmathfloatcomparisontrue
+ \fi
+ \fi
+ \fi
+}
+
+% compares \pgfmathfloat@a@[SME] > \pgfmathfloat@b@[SME]
+\def\pgfmathfloatgreaterthan@positive{%
+ \ifnum\pgfmathfloat@a@E>\pgfmathfloat@b@E
+ \global\pgfmathfloatcomparisontrue
+ \else
+ \ifnum\pgfmathfloat@a@E=\pgfmathfloat@b@E
+ \ifdim\pgfmathfloat@a@M>\pgfmathfloat@b@M
+ \global\pgfmathfloatcomparisontrue
+ \fi
+ \fi
+ \fi
+}
+
+
+\def\pgfmathfloatgreaterthan@#1#2{\pgfmathfloatlessthan@{#2}{#1}}
+\let\pgfmathfloatgreaterthan=\pgfmathfloatgreaterthan@
+
+\def\pgfmathfloatmax@#1{%
+ \begingroup
+ \pgfmathfloatcreate{2}{1.0}{2147483644}%
+ \let\pgfmathmaxsofar=\pgfmathresult
+ \pgfmathfloatmax@@#1{}%
+}%
+\def\pgfmathfloatmax@@#1{%
+ \def\pgfmath@temp{#1}%
+ \ifx\pgfmath@temp\pgfmath@empty%
+ \expandafter\pgfmathfloatmax@@@%
+ \else%
+ \pgfmathfloatlessthan{\pgfmathmaxsofar}{#1}%
+ \ifpgfmathfloatcomparison
+ \edef\pgfmathmaxsofar{#1}%
+ \fi
+ \expandafter\pgfmathfloatmax@@%
+ \fi%
+}%
+\def\pgfmathfloatmax@@@{%
+ \let\pgfmathresult=\pgfmathmaxsofar
+ \pgfmath@smuggleone{\pgfmathresult}%
+ \endgroup
+}%
+\def\pgfmathfloatmin@#1{%
+ \begingroup
+ \pgfmathfloatcreate{1}{1.0}{2147483644}%
+ \let\pgfmathminsofar=\pgfmathresult
+ \pgfmathfloatmin@@#1{}%
+}%
+\def\pgfmathfloatmin@@#1{%
+ \def\pgfmath@temp{#1}%
+ \ifx\pgfmath@temp\pgfmath@empty%
+ \expandafter\pgfmathfloatmin@@@%
+ \else%
+ \pgfmathfloatlessthan{#1}{\pgfmathminsofar}%
+ \ifpgfmathfloatcomparison
+ \edef\pgfmathminsofar{#1}%
+ \fi
+ \expandafter\pgfmathfloatmin@@%
+ \fi%
+}%
+\def\pgfmathfloatmin@@@{%
+ \let\pgfmathresult=\pgfmathminsofar
+ \pgfmath@smuggleone{\pgfmathresult}%
+ \endgroup
+}%
+
+\def\pgfmathfloatmaxtwo#1#2{%
+ \pgfmathfloatlessthan{#1}{#2}%
+ \ifpgfmathfloatcomparison
+ \edef\pgfmathresult{#2}%
+ \else
+ \edef\pgfmathresult{#1}%
+ \fi
+}
+\let\pgfmathfloatmax=\pgfmathfloatmaxtwo
+
+\def\pgfmathfloatmintwo#1#2{%
+ \pgfmathfloatlessthan{#1}{#2}%
+ \ifpgfmathfloatcomparison
+ \edef\pgfmathresult{#1}%
+ \else
+ \edef\pgfmathresult{#2}%
+ \fi
+}
+\let\pgfmathfloatmin=\pgfmathfloatmintwo
+
+% Renormalizes #1 to extended precision mantisse, meaning
+% 100 <= m < 1000
+% instead of 1 <= m < 10.
+%
+% The 'extended precision' means we have higher accuracy when we apply pgfmath operations to mantisses.
+%
+% The input argument is expected to be a normalized floating point number; the output argument is a non-normalized floating point number (well, normalized to extended precision).
+%
+% The operation is supposed to be very fast.
+%
+% @see \pgfmathfloatsetextprecision
+%
+% There is a routine for internal usage,
+% \pgfmathfloattoextentedprecision@a. It also provides exponent and
+% sign of #1 in output arguments and may be used to increase speed.
+\def\pgfmathfloattoextentedprecision#1{%
+ \begingroup
+ \pgfmathfloattoextentedprecision@a{#1}%
+ \pgfmathfloatcreate{\pgfmathfloat@a@S}{\pgfmathresult}{\pgfmathfloat@a@E}%
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}%
+
+\def\pgfmathfloattoextentedprecision@@zero#1\pgfmathfloat@EOI{%
+ \edef\pgfmathresult{#1}%
+}%
+\def\pgfmathfloattoextentedprecision@@one#1.#2#3\pgfmathfloat@EOI{%
+ \edef\pgfmathresult{#1#2.#3}%
+}%
+\def\pgfmathfloattoextentedprecision@@two#1.#2#3#4\pgfmathfloat@EOI{%
+ \edef\pgfmathresult{#1#2#3.#4}%
+}%
+\def\pgfmathfloattoextentedprecision@@three#1.#2#3#4#5\pgfmathfloat@EOI{%
+ \edef\pgfmathresult{#1#2#3#4.#5}%
+}%
+
+% Sets extended precision to 10^#1.
+%
+% The different choices are
+%
+% - 0: normalization 0 <= m < 1 (disable extended precision)
+% - 1: normalization 10 <= m < 100
+% - 2: normalization 100 <= m < 1000 (default)
+% - 3: normalization 1000 <= m < 10000
+%
+% #1 is the exponent, #1 = 0,1,2 or 3.
+%
+% This setting applies to \pgfmathfloattoextentedprecision and friends.
+\def\pgfmathfloatsetextprecision#1{%
+ \ifcase#1\relax
+ \let\pgfmathfloattoextentedprecision@@=\pgfmathfloattoextentedprecision@@zero
+ \def\pgfmathfloatextprec@shift{0}%
+ \or
+ \let\pgfmathfloattoextentedprecision@@=\pgfmathfloattoextentedprecision@@one
+ \def\pgfmathfloatextprec@shift{1}%
+ \or
+ \let\pgfmathfloattoextentedprecision@@=\pgfmathfloattoextentedprecision@@two
+ \def\pgfmathfloatextprec@shift{2}%
+ \else
+ \let\pgfmathfloattoextentedprecision@@=\pgfmathfloattoextentedprecision@@three
+ \def\pgfmathfloatextprec@shift{3}%
+ \fi
+}%
+\pgfmathfloatsetextprecision{2}%
+
+% Does the "hard" work for \pgfmathfloattoextentedprecision. It
+% provides additional outputs.
+%
+% INPUT:
+% #1 normalized floating point number. Maybe a macro (it will be expanded ONCE)
+%
+% OUTPUT:
+% - \pgfmathresult : the mantisse in extended precision
+% - \pgfmathfloat@a@S : the sign of #1
+% - \pgfmathfloat@a@E : the exponent of #1, adjusted for extended precision
+% - \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
+ \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
+ \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
+}%
+
+% Addition of two floating point numbers using 8 significant digits.
+\def\pgfmathfloatadd@#1#2{%
+ \begingroup
+ %
+ % renormalize argument to 100 <= m < 1000 for extended accuracy:
+ \pgfmathfloattoextentedprecision@a{#1}%
+ \let\pgfmathfloat@arga=\pgfmathresult
+ %
+ \pgfmathfloattoextentedprecision@b{#2}%
+ \let\pgfmathfloat@argb=\pgfmathresult
+ %
+ \pgfmathfloatcomparisontrue% re-use this boolean here to handle special cases.
+ \ifcase\pgfmathfloat@a@S
+ \edef\pgfmathresult{#2}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \or
+ \edef\pgfmathfloat@arga{-\pgfmathfloat@arga}%
+ \else
+ \pgfmathfloatcomparisonfalse
+ \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{0.0}{0}%
+ \fi
+ \ifcase\pgfmathfloat@b@S
+ \edef\pgfmathresult{#1}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \or
+ \edef\pgfmathfloat@argb{-\pgfmathfloat@argb}%
+ \else
+ \pgfmathfloatcomparisonfalse
+ \pgfmathfloatcreate{\the\pgfmathfloat@b@S}{0.0}{0}%
+ \fi
+ \ifpgfmathfloatcomparison
+ % Shift lesser mantisse to fit the larger one:
+ \ifnum\pgfmathfloat@a@E<\pgfmathfloat@b@E
+ \pgfmathfloatadd@shift{\pgfmathfloat@arga}{\pgfmathfloat@a@E}{\pgfmathfloat@b@E}%
+ \else
+ \pgfmathfloatadd@shift{\pgfmathfloat@argb}{\pgfmathfloat@b@E}{\pgfmathfloat@a@E}%
+ \fi
+ % add them!
+ \pgfmath@basic@add@{\pgfmathfloat@arga}{\pgfmathfloat@argb}%
+ % renormalize sum. This is the only part were an expensive routine comes into play:
+ \edef\pgfmathresult{\pgfmathresult e\the\pgfmathfloat@a@E}%
+ \expandafter\pgfmathfloatqparsenumber\expandafter{\pgfmathresult}%
+ \fi
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}%
+
+% #1= floating point number
+% #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
+}%
+
+% #1=mantisse which needs to be shifted (with smaller exponent)
+% #2=smaller exponent
+% #3=larger exponent
+%
+% ATTENTION: this helper method DESTROYS contents of \pgfmathfloat@a@S.
+\def\pgfmathfloatadd@shift#1#2#3{%
+ \pgf@xa=#1 pt%
+ \pgfmathfloat@a@S=#3\relax
+ \advance\pgfmathfloat@a@S by-#2\relax
+ \ifcase\pgfmathfloat@a@S
+ \or
+ \divide\pgf@xa by10\relax
+ \or
+ \divide\pgf@xa by100\relax
+ \or
+ \divide\pgf@xa by1000\relax
+ \or
+ \divide\pgf@xa by10000\relax
+ \or
+ \divide\pgf@xa by10000\relax
+ \divide\pgf@xa by10\relax
+ \or
+ \divide\pgf@xa by10000\relax
+ \divide\pgf@xa by100\relax
+ \or
+ \divide\pgf@xa by10000\relax
+ \divide\pgf@xa by1000\relax
+ \or
+ \divide\pgf@xa by10000\relax
+ \divide\pgf@xa by10000\relax
+ \else
+ \pgf@xa=0pt%
+ \fi
+ #2=#3\relax
+ \edef#1{\pgf@sys@tonumber\pgf@xa}%
+}
+
+\let\pgfmathfloatadd=\pgfmathfloatadd@
+
+
+% 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
+ \ifcase\pgfmathfloat@b@S
+ \edef\pgfmathresult{#1}%
+ \or
+ \pgfmathfloatcreate{2}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@b@E}%
+ \let\pgfmathfloatsub@arg=\pgfmathresult
+ \pgfmathfloatadd@{#1}{\pgfmathfloatsub@arg}%
+ \or
+ \pgfmathfloatcreate{1}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@b@E}%
+ \let\pgfmathfloatsub@arg=\pgfmathresult
+ \pgfmathfloatadd@{#1}{\pgfmathfloatsub@arg}%
+ \else
+ \pgfmathfloatcreate{\the\pgfmathfloat@b@S}{0.0}{0}%
+ \fi
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}%
+
+\let\pgfmathfloatsubtract=\pgfmathfloatsubtract@
+
+% Scales a floating point number #1 with a fixed point number #2 using pgfmathmultiply.
+%
+% Use this method if #2 is small number.
+\def\pgfmathfloatmultiplyfixed@#1#2{%
+ \begingroup
+ %
+ % renormalize argument to 100 <= m < 1000 for extended accuracy:
+ \pgfmathfloattoextentedprecision@a{#1}%
+ \let\pgfmathfloat@arga=\pgfmathresult
+ %
+ \pgfmathfloatcomparisontrue% re-use this boolean here to handle special cases.
+ \ifcase\pgfmathfloat@a@S
+ \edef\pgfmathresult{#1}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \or
+ \edef\pgfmathfloat@arga{-\pgfmathfloat@arga}%
+ \else
+ \pgfmathfloatcomparisonfalse
+ \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{0.0}{0}%
+ \fi
+ \ifpgfmathfloatcomparison
+ \pgfmath@basic@multiply@{\pgfmathfloat@arga}{#2}%
+ % renormalize product. This is the only part were an expensive routine comes into play:
+ \edef\pgfmathresult{\pgfmathresult e\the\pgfmathfloat@a@E}%
+ \expandafter\pgfmathfloatqparsenumber\expandafter{\pgfmathresult}%
+ \fi
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}%
+
+\let\pgfmathfloatmultiplyfixed=\pgfmathfloatmultiplyfixed@
+
+
+\def\pgfmathfloatmultiply@#1#2{%
+ \begingroup
+ \pgfmathfloatsetextprecision{1}%
+ \edef\pgfmathfloat@arga{#1}%
+ \pgfmathfloattoextentedprecision@a{\pgfmathfloat@arga}%
+ \let\pgfmathfloat@arga=\pgfmathresult
+ %
+ \edef\pgfmathfloat@argb{#2}%
+ \pgfmathfloattoextentedprecision@b{\pgfmathfloat@argb}%
+ \let\pgfmathfloat@argb=\pgfmathresult
+ %
+ \pgfmathfloatcomparisontrue% re-use this boolean here to handle special cases.
+ \ifcase\pgfmathfloat@a@S
+ % 0
+ \pgfmathfloatcreate{0}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or% +
+ \ifcase\pgfmathfloat@b@S
+ \pgfmathfloatcreate{0}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \def\pgfmathresult@S{1}%
+ \or
+ \def\pgfmathresult@S{2}%
+ \else
+ \expandafter\pgfmathfloatcreate\the\pgfmathfloat@b@S{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \fi
+ \or% -
+ \ifcase\pgfmathfloat@b@S
+ \pgfmathfloatcreate{0}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \def\pgfmathresult@S{2}%
+ \or
+ \def\pgfmathresult@S{1}%
+ \or
+ \pgfmathfloatcreate{3}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \pgfmathfloatcreate{5}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \pgfmathfloatcreate{4}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \fi
+ \or% nan
+ \pgfmathfloatcreate{3}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or% +infty
+ \ifcase\pgfmathfloat@b@S
+ \pgfmathfloatcreate{0}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \pgfmathfloatcreate{4}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \pgfmathfloatcreate{5}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \pgfmathfloatcreate{3}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \pgfmathfloatcreate{4}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \pgfmathfloatcreate{5}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \fi
+ \or% -infty
+ \ifcase\pgfmathfloat@b@S
+ \pgfmathfloatcreate{0}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \pgfmathfloatcreate{5}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \pgfmathfloatcreate{4}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \pgfmathfloatcreate{3}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \pgfmathfloatcreate{5}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \pgfmathfloatcreate{4}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \fi
+ \fi
+ \ifpgfmathfloatcomparison
+ \pgfmath@basic@multiply@{\pgfmathfloat@arga}{\pgfmathfloat@argb}%
+ \advance\pgfmathfloat@a@E by\pgfmathfloat@b@E
+ % renormalize sum. This is the only part were an expensive routine comes into play:
+ \edef\pgfmathresult{\pgfmathresult e\the\pgfmathfloat@a@E}%
+ \expandafter\pgfmathfloatqparsenumber\expandafter{\pgfmathresult}%
+ \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
+ \pgfmathfloatcreate{\pgfmathresult@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}%
+ \fi
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}%
+\let\pgfmathfloatmultiply=\pgfmathfloatmultiply@
+
+% Defines \pgfmathresult to be #1 / #2 for two floating point numbers.
+%
+% It employs the basic math engine internally to divide mantissas.
+\def\pgfmathfloatdivide@#1#2{%
+ \begingroup
+ \pgfmathfloatsetextprecision{1}% is not too important, I think. After all, 0.1 <= #1/#2 < 10 or so due to normalization (no matter, which)
+ \edef\pgfmathfloat@arga{#1}%
+ \pgfmathfloattoextentedprecision@a{\pgfmathfloat@arga}%
+ \let\pgfmathfloat@arga=\pgfmathresult
+ %
+ \edef\pgfmathfloat@argb{#2}%
+ \pgfmathfloattoextentedprecision@b{\pgfmathfloat@argb}%
+ \let\pgfmathfloat@argb=\pgfmathresult
+ %
+ \pgfmathfloatcomparisontrue% re-use this boolean here to handle special cases.
+ \ifcase\pgfmathfloat@a@S
+ % 0
+ \pgfmathfloatcreate{0}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or% +
+ \ifcase\pgfmathfloat@b@S
+ \pgfmathfloatcreate{4}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \def\pgfmathresult@S{1}%
+ \or
+ \def\pgfmathresult@S{2}%
+ \or
+ \pgfmathfloatcreate{3}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \else
+ \pgfmathfloatcreate{0}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \fi
+ \or% -
+ \ifcase\pgfmathfloat@b@S
+ \pgfmathfloatcreate{5}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \def\pgfmathresult@S{2}%
+ \or
+ \def\pgfmathresult@S{1}%
+ \or
+ \pgfmathfloatcreate{3}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \else
+ \pgfmathfloatcreate{0}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \fi
+ \or% nan
+ \pgfmathfloatcreate{3}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or% +infty
+ \ifcase\pgfmathfloat@b@S
+ \pgfmathfloatcreate{4}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \pgfmathfloatcreate{4}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \pgfmathfloatcreate{5}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \pgfmathfloatcreate{3}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \pgfmathfloatcreate{4}{0.0}{0}% what is inf/inf ?
+ \pgfmathfloatcomparisonfalse
+ \or
+ \pgfmathfloatcreate{5}{0.0}{0}% or inf/-inf ?
+ \pgfmathfloatcomparisonfalse
+ \fi
+ \or% -infty
+ \ifcase\pgfmathfloat@b@S
+ \pgfmathfloatcreate{5}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \pgfmathfloatcreate{5}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \pgfmathfloatcreate{4}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \pgfmathfloatcreate{3}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \pgfmathfloatcreate{5}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \pgfmathfloatcreate{4}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \fi
+ \fi
+ \ifpgfmathfloatcomparison
+ \pgfmath@basic@divide@{\pgfmathfloat@arga}{\pgfmathfloat@argb}%
+ \advance\pgfmathfloat@a@E by-\pgfmathfloat@b@E
+ % renormalize. This is the only part were an expensive float routine comes into play:
+ \edef\pgfmathresult{\pgfmathresult e\the\pgfmathfloat@a@E}%
+ \expandafter\pgfmathfloatqparsenumber\expandafter{\pgfmathresult}%
+ % And re-insert the proper sign:
+ \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
+ \pgfmathfloatcreate{\pgfmathresult@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}%
+ \fi
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}%
+\let\pgfmathfloatdivide=\pgfmathfloatdivide@
+
+\def\pgfmathfloatreciprocal@#1{%
+ \begingroup
+ % FIXME optimize
+ \edef\pgfmathfloat@loc@TMPa{#1}%
+ \pgfmathfloatcreate{1}{1.0}{0}%
+ \pgfmathfloatdivide@{\pgfmathresult}{\pgfmathfloat@loc@TMPa}%
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}%
+
+% Computes sqrt(#1) in floating point arithmetics.
+%
+% It employs sqrt( m * 10^e ) = sqrt(m) * sqrt(10^e).
+\def\pgfmathfloatsqrt@#1{%
+ \begingroup
+ \pgfmathfloatsetextprecision{3}%
+ \edef\pgfmathfloat@arga{#1}%
+ \pgfmathfloattoextentedprecision@a{\pgfmathfloat@arga}%
+ \let\pgfmathfloat@arga=\pgfmathresult
+ %
+ \ifcase\pgfmathfloat@a@S
+ % 0
+ \pgfmathfloatcreate{0}{0.0}{0}%
+ \or% +
+ \pgfmath@basic@sqrt@{\pgfmathfloat@arga}%
+ \ifodd\pgfmathfloat@a@E
+ \ifnum\pgfmathfloat@a@E>0
+ \expandafter\pgfmath@basic@multiply@\expandafter{\pgfmathresult}{3.16227766}% * sqrt(10)
+ \else
+ \expandafter\pgfmath@basic@multiply@\expandafter{\pgfmathresult}{0.316227766}% * sqrt(0.1)
+ \fi
+ \fi
+ \divide\pgfmathfloat@a@E by2 % sqrt(10^e) = 10^{e/2} (see above for odd e)
+ % renormalize sum. This is the only part were an expensive routine comes into play:
+ \edef\pgfmathfloat@arga{\pgfmathresult e\the\pgfmathfloat@a@E}%
+ \pgfmathfloatqparsenumber{\pgfmathfloat@arga}%
+ \or% -
+ \pgfmathfloatcreate{3}{0.0}{0}%
+ \or% nan
+ \pgfmathfloatcreate{3}{0.0}{0}%
+ \or% +infty
+ \pgfmathfloatcreate{4}{0.0}{0}%
+ \or% -infty
+ \pgfmathfloatcreate{3}{0.0}{0}%
+ \fi
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}%
+\let\pgfmathfloatsqrt=\pgfmathfloatsqrt@
+
+% Returns the integer part of the floating point number #1.
+%
+% The result is returned as floating point as well.
+%
+% This operation is not limited to TeX's range of count registers (it
+% works symbolly)
+\def\pgfmathfloatint@#1{%
+ \begingroup
+ \edef\pgfmathresult{#1}%
+ \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
+ \ifcase\pgfmathfloat@a@S
+ % 0: nothing to do.
+ \or% +
+ \expandafter\pgfmathfloatint@@\the\pgfmathfloat@a@Mtok\pgfmathfloat@EOI
+ \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}%
+ \or% -
+ \expandafter\pgfmathfloatint@@\the\pgfmathfloat@a@Mtok\pgfmathfloat@EOI
+ \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}%
+ \else
+ % nothing to do
+ \fi
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}%
+\def\pgfmathfloatint@@#1.{%
+ \ifnum\pgfmathfloat@a@E<0
+ \pgfmathfloat@a@S=0
+ \pgfmathfloat@a@Mtok={0.0}%
+ \pgfmathfloat@a@E=0
+ \expandafter\pgfmathfloatint@@loop@gobble
+ \else
+ \pgfmathfloat@a@Mtok={#1.}%
+ \pgfmathfloat@b@E=\pgfmathfloat@a@E
+ \expandafter\pgfmathfloatint@@loop
+ \fi
+}%
+\def\pgfmathfloatint@@loop#1{%
+ \def\pgfmathfloatint@@loop@{#1}%
+ \ifx\pgfmathfloatint@@loop@\pgfmathfloat@EOI
+ \let\pgfmathfloatint@@loop@next=\relax
+ \else
+ \ifnum\pgfmathfloat@b@E=0
+ \let\pgfmathfloatint@@loop@next=\pgfmathfloatint@@loop@gobble
+ \else
+ \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok#1}%
+ \advance\pgfmathfloat@b@E by-1
+ \let\pgfmathfloatint@@loop@next=\pgfmathfloatint@@loop
+ \fi
+ \fi
+ \pgfmathfloatint@@loop@next
+}%
+\def\pgfmathfloatint@@loop@gobble#1\pgfmathfloat@EOI{}%
+\let\pgfmathfloatint=\pgfmathfloatint@
+\let\pgfmathfloatfloor=\pgfmathfloatint
+\let\pgfmathfloatfloor@=\pgfmathfloatint@
+
+\def\pgfmathfloat@notimplemented#1{%
+ \pgfmath@error{Sorry, the operation '#1' has not yet been implemented in the floating point unit :-(}{}%
+ \pgfmathfloatcreate{0}{0.0}{0}%
+}%
+
+% Divides or multiplies the input number by 10^#4 using an arithmetic
+% left/right shift.
+%
+% Input:
+% #1 a normalised floating point number.
+% #2 a positive or negative integer number denoting the shift.
+%
+% Example:
+% \pgfmathfloatshift{11e3}{4}%
+% -> pgfmathresult = 11e7
+\def\pgfmathfloatshift@#1#2{%
+ \begingroup
+ \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
+ \advance\pgfmathfloat@a@E by#2\relax
+ \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}%
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}
+\let\pgfmathfloatshift=\pgfmathfloatshift@
+
+% Defines \pgfmathresult to be |#1|, the absolute value of the
+% normalized floating point number #1.
+\def\pgfmathfloatabs@#1{%
+ \begingroup
+ \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
+ \ifcase\pgfmathfloat@a@S
+ % 0: do nothing.
+ \or
+ % +: ok, is positive.
+ \or
+ % -: multiply with -1:
+ \pgfmathfloat@a@S=1
+ \or
+ % nan: do nothing.
+ \or
+ % +infty: ok.
+ \or
+ % -infty: multiply with -1:
+ \pgfmathfloat@a@S=4
+ \fi
+ \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}%
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}%
+\let\pgfmathfloatabs=\pgfmathfloatabs@
+
+% Computes the absolute error |#1 - #2| into \pgfmathresult.
+\def\pgfmathfloatabserror@#1#2{%
+ \pgfmathfloatsubtract@{#1}{#2}%
+ \pgfmathfloatabs@{\pgfmathresult}%
+}%
+\let\pgfmathfloatabserror=\pgfmathfloatabserror@
+
+% Computes the relative error |#1 - #2|/|#2| into \pgfmathresult,
+% assuming #2 != 0.
+\def\pgfmathfloatrelerror@#1#2{%
+ \pgfmathfloatsubtract@{#1}{#2}%
+ \pgfmathfloatdivide@{\pgfmathresult}{#2}%
+ \pgfmathfloatabs@{\pgfmathresult}%
+}%
+\let\pgfmathfloatrelerror=\pgfmathfloatrelerror@
+
+% Computes \pgfmathresult = #1 mod #2 using truncated division.
+%
+\def\pgfmathfloatmod@#1#2{%
+ \begingroup
+ \pgfmathfloatdivide@{#1}{#2}%
+ \pgfmathfloatint@{\pgfmathresult}%
+ \let\pgfmathfloat@loc@TMPa=\pgfmathresult
+ \pgfmathfloatmultiply@{\pgfmathfloat@loc@TMPa}{#2}%
+ \let\pgfmathfloat@loc@TMPb=\pgfmathresult
+ \pgfmathfloatsubtract@{#1}{\pgfmathfloat@loc@TMPb}%
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}
+\let\pgfmathfloatmod=\pgfmathfloatmod@
+
+% A modification of \pgfmathfloatmod@ where #3 = 1/#2 is already
+% known. This may be faster.
+\def\pgfmathfloatmodknowsinverse@#1#2#3{%
+ \begingroup
+ \pgfmathfloatmultiply@{#1}{#3}%
+ \pgfmathfloatint@{\pgfmathresult}%
+ \let\pgfmathfloat@loc@TMPa=\pgfmathresult
+ \pgfmathfloatmultiply@{\pgfmathfloat@loc@TMPa}{#2}%
+ \let\pgfmathfloat@loc@TMPb=\pgfmathresult
+ \pgfmathfloatsubtract@{#1}{\pgfmathfloat@loc@TMPb}%
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}
+\let\pgfmathfloatmodknowsinverse=\pgfmathfloatmodknowsinverse@
+
+\def\pgfmathfloatpi@{%
+ \pgfmathfloatcreate{1}{3.14159265358979}{0}%
+}%
+\let\pgfmathfloatpi=\pgfmathfloatpi@
+
+\def\pgfmathfloate@{%
+ \pgfmathfloatcreate{1}{2.71828182845905}{0}%
+}
+\let\pgfmathfloate=\pgfmathfloate@
+
+% Converts #1 from radians to degrees.
+\def\pgfmathfloatdeg@#1{%
+ \expandafter\ifx\csname pgfmfltdeg@factor\endcsname\relax
+ % Lazy evaluation:
+ \pgfmathfloatcreate{1}{5.72957795130823}{1}%
+ \global\let\pgfmfltdeg@factor=\pgfmathresult
+ \fi
+ \pgfmathfloatmultiply@{#1}\pgfmfltdeg@factor%
+}
+\let\pgfmathfloatdeg=\pgfmathfloatdeg@
+
+% Converts #1 from degree to radians.
+\def\pgfmathfloatrad@#1{%
+ \expandafter\ifx\csname pgfmfltrad@factor\endcsname\relax
+ % Lazy evaluation:
+ \pgfmathfloatcreate{1}{1.74532925199433}{-2}%
+ \global\let\pgfmfltrad@factor=\pgfmathresult
+ \fi
+ \pgfmathfloatmultiply@{#1}\pgfmfltrad@factor%
+}
+\let\pgfmathfloatrad=\pgfmathfloatrad@
+
+% Computes #1(#2) where #1 is a trigonometric function, i.e.
+% #1(#2) = #1( #2 + r*360 )
+%
+% #1 is a one-argument macro which assigns \pgfmathresult.
+\def\pgfmathfloatTRIG@#1#2{%
+ \expandafter\ifx\csname pgfmathfloatTRIG@NUM\endcsname\relax% why not directly!??? Did not work!??
+ % Lazy evaluation:
+ \pgfmathfloatcreate{1}{3.6}{2}%
+ \global\let\pgfmathfloatTRIG@NUM=\pgfmathresult
+ \pgfmathfloatcreate{1}{2.77777777777778}{-3}%
+ \global\let\pgfmathfloatTRIG@NUM@INV=\pgfmathresult
+ \fi
+ \pgfmathfloatmodknowsinverse@{#2}{\pgfmathfloatTRIG@NUM}{\pgfmathfloatTRIG@NUM@INV}%
+ \pgfmathfloattofixed@{\pgfmathresult}%
+ \expandafter#1\expandafter{\pgfmathresult}%
+ \pgfmathfloatparsenumber{\pgfmathresult}%
+}%
+
+\def\pgfmathfloatsin@#1{\pgfmathfloatTRIG@\pgfmath@basic@sin@{#1}}
+\let\pgfmathfloatsin=\pgfmathfloatsin@
+\def\pgfmathfloatcos@#1{\pgfmathfloatTRIG@\pgfmath@basic@cos@{#1}}
+\let\pgfmathfloatcos=\pgfmathfloatcos@
+\def\pgfmathfloattan@#1{%
+ % compute sin(#1) / cos(#1)
+ \begingroup
+ \pgfmathfloatcos@{#1}%
+ \let\pgfmathfloat@loc@TMPa=\pgfmathresult
+ \pgfmathfloatsin@{#1}%
+ \expandafter\pgfmathfloatdivide@\expandafter{\pgfmathresult}{\pgfmathfloat@loc@TMPa}%
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}
+\let\pgfmathfloattan=\pgfmathfloattan@
+
+\def\pgfmathfloatcot@#1{%
+ % compute cos(#1) / sin(#1)
+ \begingroup
+ \pgfmathfloatsin@{#1}%
+ \let\pgfmathfloat@loc@TMPa=\pgfmathresult
+ \pgfmathfloatcos@{#1}%
+ \expandafter\pgfmathfloatdivide@\expandafter{\pgfmathresult}{\pgfmathfloat@loc@TMPa}%
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}%
+\let\pgfmathfloatcot=\pgfmathfloatcot@
+
+\def\pgfmathfloatatan@#1{%
+ \begingroup
+ \expandafter\ifx\csname pgfmathfloatatan@TMP\endcsname\relax% why not directly!??? Did not work!??
+ \pgfmathfloatcreate{1}{1.6}{4}%
+ \global\let\pgfmathfloatatan@TMP=\pgfmathresult
+ \pgfmathfloatcreate{2}{1.6}{4}%
+ \global\let\pgfmathfloatatan@TMPB=\pgfmathresult
+ \fi
+ \pgfmathfloatgreaterthan@{#1}{\pgfmathfloatatan@TMP}%
+ \ifpgfmathfloatcomparison
+ \pgfmathfloatcreate{1}{9.0}{1}%
+ \else
+ \pgfmathfloatlessthan{#1}{\pgfmathfloatatan@TMPB}%
+ \ifpgfmathfloatcomparison
+ \pgfmathfloatcreate{2}{9.0}{1}%
+ \else
+ \pgfmathfloattofixed@{#1}%
+ \expandafter\pgfmath@basic@atan@\expandafter{\pgfmathresult}%
+ \pgfmathfloatparsenumber{\pgfmathresult}%
+ \fi
+ \fi
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}%
+\let\pgfmathfloatatan=\pgfmathfloatatan@
+
+\def\pgfmathfloatsec@#1{\pgfmathfloatTRIG@\pgfmath@basic@cos@{#1}\pgfmathfloatreciprocal@{\pgfmathresult}}
+\let\pgfmathfloatsec=\pgfmathfloatsec@
+\def\pgfmathfloatcosec@#1{\pgfmathfloatTRIG@\pgfmath@basic@sin@{#1}\pgfmathfloatreciprocal@{\pgfmathresult}}
+\let\pgfmathfloatcosec=\pgfmathfloatcosec@
+
+% Expands #2 using \edef and invokes #1 with the resulting string.
+%
+% DEPRECATED
+% Example:
+% \pgfmath@y=7.9pt
+% \pgfmathlog@invoke@expanded\pgfmathexp@{{\pgf@sys@tonumber{\pgfmath@y}}}%
+% will invoke
+% \pgfmathexp@{7.9}
+\def\pgfmathlog@invoke@expanded#1#2{%
+ \edef\pgfmath@resulttemp{#2}%
+ \expandafter#1\pgfmath@resulttemp
+}
+
+\def\pgfmathfloatln@#1{%
+ \pgfmathlog@float{#1}%
+ \ifx\pgfmathresult\pgfutil@empty
+ \pgfmathfloatcreate{3}{0.0}{0}%
+ \else
+ \pgfmathfloatparsenumber{\pgfmathresult}%
+ \fi
+}
+\let\pgfmathfloatln=\pgfmathfloatln@
+
+% Computes log(x) into \pgfmathresult.
+%
+% This allows numbers such at 10000000 or 5.23e-10 to be represented
+% properly, although TeX-registers would produce overflow/underflow
+% errors in these cases.
+%
+% The natural logarithm is computed using log(X*10^Y) = log(X) + log(10)*Y
+%
+% FIXME This routine is only kept for backwards compatibility!
+% It does not work as expected because
+% 1. it calls \pgfmathfloatparsenumber
+% 2. it returns the result as fixed point number
+% Use \pgfmathln@ instead!
+\def\pgfmathlog@#1{%
+ \pgfmathfloatparsenumber{#1}%
+ \pgfmathlog@float{\pgfmathresult}%
+}
+\let\pgfmathlog=\pgfmathlog@
+\def\pgfmathlog@float#1{%
+ \begingroup%
+ % compute #1 = M*10^E with normalised mantisse M = [+-]*[1-9].XXXXX
+ \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
+ \ifnum\pgfmathfloat@a@S=1
+ % Now, compute log(#1) = log(M) + E*log(10)
+ \expandafter\pgfmath@basic@ln@\expandafter{\the\pgfmathfloat@a@Mtok}%
+ \pgfmathfloat@b@M=\pgfmathresult pt%
+ \pgfmathfloat@a@M=2.302585pt% = log(10)
+ \multiply\pgfmathfloat@a@M by\pgfmathfloat@a@E\relax
+ \advance\pgfmathfloat@b@M by\pgfmathfloat@a@M
+ \edef\pgfmathresult{\pgf@sys@tonumber{\pgfmathfloat@b@M}}%
+ \else
+ \let\pgfmathresult=\pgfutil@empty%
+ \fi
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup%
+}
+
+
+% Computes exp(#1) in floating point.
+%
+% The algorithm employs the identity
+% exp(x) = exp(x - log(10^k) + log(10^k)
+% = 10^k exp( x - k*log 10 )
+% with k choosen such that exp( x - k*log10) can be computed with the
+% basic level math engine.
+%
+% The precision (relative error) is between 10^{-4} and 10^{-6}. For
+% #1 = 700, it is even 10^{-3}. I will need to improve that someday.
+\def\pgfmathfloatexp@#1{%
+ \begingroup
+ \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
+ \ifcase\pgfmathfloat@a@S
+ % #1 = 0:
+ \pgfmathfloatcreate{1}{1.0}{0}%
+ \or% #1 > 0
+ \pgfmathfloatexp@@{#1}%
+ \or% #1 < 0
+ \pgfmathfloatexp@@{#1}%
+ \else
+ \edef\pgfmathresult{#1}%
+ \fi
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}%
+\def\pgfmathfloatexp@@#1{%
+ % Employ the identity
+ % exp(x) = exp(x - log(10^k) + log(10^k)) = 10^k exp( x - k *log(10))
+ %
+ % I'd like to have x - k*log(10) <= 1
+ % => compute k := int( (x - 1) * 1/log(10) )
+ % that should suffice since \pgfmathexp@ should be
+ % accurate enough for those numbers.
+ %
+ % please note that we can do all this in TeX registers.
+ % exp(700) is almost the maximum of double precision
+ % anyway, and exp(16000) is certainly the largest we will
+ % ever need.
+ \pgfmathfloattofixed@{#1}%
+ \pgf@xa=\pgfmathresult pt
+ \pgf@xa=0.434294481\pgf@xa\relax
+ \edef\pgfmathfloat@loc@TMPa{\pgf@sys@tonumber{\pgf@xa}}%
+ \expandafter\pgfmathfloatexp@@toint\pgfmathfloat@loc@TMPa\relax
+ \pgf@xa=2.302585092pt
+ \multiply\pgf@xa by-\pgfmathfloat@k\relax
+ \advance\pgf@xa by\pgfmathresult pt
+ \edef\pgfmathfloat@loc@TMPa{\pgf@sys@tonumber{\pgf@xa}}%
+%\message{computing exp(\pgfmathresult) = 10^\pgfmathfloat@k * exp(\pgfmathfloat@loc@TMPa)...}%
+ \pgfmath@basic@exp@{\pgfmathfloat@loc@TMPa}%
+ \let\pgfmathfloat@loc@TMPa=\pgfmathresult
+ \pgfmathfloatparsenumber{\pgfmathfloat@loc@TMPa}%
+ \let\pgfmathfloat@loc@TMPa=\pgfmathresult
+ \pgfmathfloatshift@{\pgfmathfloat@loc@TMPa}{\pgfmathfloat@k}%
+}
+% determine 'k'. This is a heuristics. The exponential series
+% converges best for |x| <= 1. However, the fixed point arithmetics
+% for tex results in best results for large |x|. Well, I'll need to
+% tune this here.
+\def\pgfmathfloatexp@@toint#1.#2\relax{%
+ \c@pgf@counta=#1\relax
+ \ifnum\c@pgf@counta<0
+\advance\c@pgf@counta by-1 % FIXME . this is a test for optimizations.
+ \c@pgf@countb=#2\relax
+ \ifnum\c@pgf@countb>0
+ \advance\c@pgf@counta by-1
+ \fi
+ \fi
+ \edef\pgfmathfloat@k{\the\c@pgf@counta}%
+}%
+\let\pgfmathfloatexp=\pgfmathfloatexp@
+
+\def\pgfmathfloatround@#1{%
+ \begingroup
+ \pgfkeysvalueof{/pgf/number format/precision/.@cmd}0\pgfeov
+ \pgfmathfloattofixed{#1}%
+ \pgfmathroundto{\pgfmathresult}%
+ \pgfmathfloatparsenumber{\pgfmathresult}%
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}%
+
+
+\def\pgfmathfloatneg@#1{%
+ \begingroup
+ \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
+ \ifcase\pgfmathfloat@a@S\relax
+ % 0:
+ \edef\pgfmathresult{#1}%
+ \or
+ % +:
+ \pgfmathfloatcreate{2}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}%
+ \or
+ % -:
+ \pgfmathfloatcreate{1}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}%
+ \or
+ % nan:
+ \edef\pgfmathresult{#1}%
+ \or
+ % +infty:
+ \pgfmathfloatcreate{5}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}%
+ \or
+ % -infty:
+ \pgfmathfloatcreate{4}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}%
+ \fi
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}%
+
+
+\def\pgfmathfloatpow@#1#2{%
+ \begingroup%
+ \expandafter\pgfmathfloat@decompose@tok#2\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
+ \ifcase\pgfmathfloat@a@S\relax
+ % #1 ^ 0 = 1
+ \pgfmathfloatcreate{1}{1.0}{0}%
+ \or
+ % #2 > 0
+ \pgfmathfloatpow@@{#1}{#2}%
+ \or
+ % #2 < 0
+ \pgfmathfloatpow@@{#1}{#2}%
+ \or
+ % #2 = nan
+ \edef\pgfmathresult{#2}%
+ \or
+ % #2 = inf
+ \edef\pgfmathresult{#2}%
+ \or
+ % #2 = -inf
+ \pgfmathfloatcreate{0}{0.0}{0}%
+ \fi
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}%
+
+% computes #1^#2
+% PRECONDITIONS
+% - #2 is positive.
+\def\pgfmathfloatpow@@#1#2{%
+ \pgfmathfloattofixed@{#2}%
+ \afterassignment\pgfmath@x%
+ \expandafter\c@pgfmath@counta\pgfmathresult pt\relax%
+ \ifdim\pgfmath@x=0pt %
+ % loop "manually"; we have an integer exponent!
+ \ifnum\c@pgfmath@counta<0
+ \pgfmathfloatreciprocal@{#1}%
+ \let\pgfmathfloat@loc@TMPa=\pgfmathresult
+ \c@pgfmath@counta=-\c@pgfmath@counta
+ \else
+ \edef\pgfmathfloat@loc@TMPa{#1}%
+ \fi
+ \pgfmathfloatcreate{1}{1.0}{0}%
+ \let\pgfmathfloat@loc@TMPb=\pgfmathresult
+ \pgfmathloop
+ \ifnum\c@pgfmath@counta>0\relax%
+ \ifodd\c@pgfmath@counta%
+ \pgfmathfloatmultiply@{\pgfmathfloat@loc@TMPb}{\pgfmathfloat@loc@TMPa}%
+ \let\pgfmathfloat@loc@TMPb=\pgfmathresult
+ \fi
+ \ifnum\c@pgfmath@counta>1\relax%
+ \pgfmathfloatmultiply@{\pgfmathfloat@loc@TMPa}{\pgfmathfloat@loc@TMPa}%
+ \let\pgfmathfloat@loc@TMPa=\pgfmathresult
+ \fi%
+ \divide\c@pgfmath@counta by2\relax%
+ \repeatpgfmathloop%
+ \else
+ % employ #1^#2 = exp( #2 * ln(#1) )
+ \pgfmathfloatln@{#1}%
+ \let\pgfmathfloat@loc@TMPa=\pgfmathresult
+ \edef\pgfmathfloat@loc@TMPb{#2}%
+ \pgfmathfloatmultiply@{\pgfmathfloat@loc@TMPa}{\pgfmathfloat@loc@TMPb}%
+ \pgfmathfloatexp@{\pgfmathresult}%
+ \fi
+}
+
+\def\pgfmathfloat@definemethodfrombasic@NOARG#1{%
+ \pgfutil@ifundefined{pgfmath@basic@#1@}{%
+ \pgfutil@namelet{pgfmath@basic@#1@}{pgfmath#1@}%
+ }{}%
+ \edef\pgfmathfloat@glob@TMP{%
+ \expandafter\noexpand\csname pgfmath@basic@#1@\endcsname
+ \noexpand\pgfmathfloatparsenumber{\noexpand\pgfmathresult}%
+ }%
+ \expandafter\let\csname pgfmathfloat#1@\endcsname=\pgfmathfloat@glob@TMP%
+ \expandafter\let\csname pgfmathfloat#1\endcsname=\pgfmathfloat@glob@TMP%
+}%
+\def\pgfmathfloat@definemethodfrombasic@ONEARG#1{%
+ \pgfutil@ifundefined{pgfmath@basic@#1@}{%
+ \pgfutil@namelet{pgfmath@basic@#1@}{pgfmath#1@}%
+ }{}%
+ \edef\pgfmathfloat@glob@TMP##1{%
+ \noexpand\pgfmathfloattofixed{##1}%
+ \noexpand\expandafter
+ \expandafter\noexpand\csname pgfmath@basic@#1@\endcsname\noexpand\expandafter%
+ {\noexpand\pgfmathresult}%
+ \noexpand\pgfmathfloatparsenumber{\noexpand\pgfmathresult}%
+ }%
+ \expandafter\let\csname pgfmathfloat#1@\endcsname=\pgfmathfloat@glob@TMP%
+ \expandafter\let\csname pgfmathfloat#1\endcsname=\pgfmathfloat@glob@TMP%
+}%
+\def\pgfmathfloat@definemethodfrombasic@TWOARGS#1{%
+ \pgfutil@ifundefined{pgfmath@basic@#1@}{%
+ \pgfutil@namelet{pgfmath@basic@#1@}{pgfmath#1@}%
+ }{}%
+ \edef\pgfmathfloat@glob@TMP##1##2{%
+ \noexpand\pgfmathfloattofixed{##2}%
+ \noexpand\let\noexpand\pgfmathfloat@loc@TMPa=\noexpand\pgfmathresult
+ \noexpand\pgfmathfloattofixed{##1}%
+ \noexpand\expandafter
+ \expandafter\noexpand\csname pgfmath@basic@#1@\endcsname\noexpand\expandafter%
+ {\noexpand\pgfmathresult}{\noexpand\pgfmathfloat@loc@TMPa}%
+ \noexpand\pgfmathfloatparsenumber{\noexpand\pgfmathresult}%
+ }%
+ \expandafter\let\csname pgfmathfloat#1@\endcsname=\pgfmathfloat@glob@TMP%
+ \expandafter\let\csname pgfmathfloat#1\endcsname=\pgfmathfloat@glob@TMP%
+}%
+\pgfmathfloat@definemethodfrombasic@NOARG{rand}
+\pgfmathfloat@definemethodfrombasic@NOARG{rnd}
+\pgfmathfloat@definemethodfrombasic@NOARG{false}
+\pgfmathfloat@definemethodfrombasic@NOARG{true}
+% arcsin, arccos
+\pgfmathfloat@definemethodfrombasic@ONEARG{asin}
+\pgfmathfloat@definemethodfrombasic@ONEARG{acos}
+\pgfmathfloat@definemethodfrombasic@ONEARG{not}
+\pgfmathfloat@definemethodfrombasic@ONEARG{hex}
+\pgfmathfloat@definemethodfrombasic@ONEARG{Hex}
+\pgfmathfloat@definemethodfrombasic@ONEARG{oct}
+\pgfmathfloat@definemethodfrombasic@ONEARG{bin}
+\pgfmathfloat@definemethodfrombasic@TWOARGS{and}
+\pgfmathfloat@definemethodfrombasic@TWOARGS{or}
+
+\pgfutil@ifundefined{pgfmathdeclarefunction}{%
+ % special treatment: \pgfmathrand@ was not properly defined for pgf 2.00:
+ \let\pgfmath@basic@rand=\pgfmathrand
+ \def\pgfmathfloatrand@{%
+ \pgfmath@basic@rand
+ \pgfmathfloatparsenumber{\pgfmathresult}%
+ }%
+ % special treatment: \pgfmathrnd@ was not properly defined for pgf 2.00:
+ \let\pgfmath@basic@rnd=\pgfmathrnd
+ \def\pgfmathfloatrnd@{%
+ \pgfmath@basic@rnd
+ \pgfmathfloatparsenumber{\pgfmathresult}%
+ }%
+}{}
+
+% Implements the factorial of '#1'.
+% This does only work if '#1 < 2^32'.
+\def\pgfmathfloatfactorial@#1{%
+ \begingroup
+ \pgfmathfloattofixed{#1}%
+ % collect integer part into a 32 bit register:
+ \afterassignment\pgfmath@gobbletilpgfmath@%
+ \expandafter\c@pgfmath@counta\pgfmathresult\relax\pgfmath@%
+ \pgfmathfloatcreate{1}{1.0}{0}%
+ \let\pgfmathfloat@loc@TMPa=\pgfmathresult
+ \pgfmathloop
+ \ifnum\c@pgfmath@counta<2 %
+ \else
+ \expandafter\pgfmathfloatparsenumber\expandafter{\the\c@pgfmath@counta}%
+ \expandafter\pgfmathfloatmultiply@\expandafter{\pgfmathresult}{\pgfmathfloat@loc@TMPa}%
+ \let\pgfmathfloat@loc@TMPa=\pgfmathresult
+ \advance\c@pgfmath@counta by-1\relax%
+ \repeatpgfmathloop
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}%
+\endinput
diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex
index 0d120a8b722..871bb8b03b0 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex
+++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex
@@ -7,7 +7,7 @@
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
-\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgfplots/pgfplots/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex,v 1.3 2008/06/07 17:08:33 ludewich Exp $
+\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/pgflibraryplothandlers.code.tex,v 1.13 2008/05/22 14:32:36 ludewich Exp $
\newif\ifpgf@plot@started
diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmathfloat.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmathfloat.code.tex
index e199d44f811..3d0cad1b196 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmathfloat.code.tex
+++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmathfloat.code.tex
@@ -10,7 +10,7 @@
% This file contains methods for basic floating point arithmetics, rounding
% to arbitrary precision and number pretty printing.
%
-% Version 0.9.4 2008/03/18
+% Version 1.0 2008/09/17
\global\newif\ifpgfmathfloatcomparison
\newif\ifpgfmathfloatroundhasperiod
@@ -90,12 +90,11 @@
\def\pgfmathfloatparsenumber#1{%
\begingroup
\edef\pgfmathresult{#1}%
- \expandafter\pgfmathfloatparsenumber@impl\pgfmathresult\pgfmathfloat@EOI
+ \expandafter\pgfflt@impl\pgfmathresult\pgfflt@EOI
\ifpgfmathfloatparsenumberpendingperiod
\pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.0}%
\fi
- \edef\pgfmathresult{%
- \the\pgfmathfloat@a@S\the\pgfmathfloat@a@Mtok e\the\pgfmathfloat@a@E}%
+ \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}%
\pgfmath@smuggleone\pgfmathresult
\endgroup
}
@@ -103,18 +102,27 @@
% The same as \pgfmathfloatparsenumber, but does not perform sanity checking.
\def\pgfmathfloatqparsenumber#1{%
\begingroup
- \let\pgfmathfloatparsenumber@sanitize@digit=\relax
\edef\pgfmathresult{#1}%
- \expandafter\pgfmathfloatparsenumber@impl\pgfmathresult\pgfmathfloat@EOI
+ \expandafter\pgfflt@impl\pgfmathresult\pgfflt@EOI
\ifpgfmathfloatparsenumberpendingperiod
\pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.0}%
\fi
- \edef\pgfmathresult{%
- \the\pgfmathfloat@a@S\the\pgfmathfloat@a@Mtok e\the\pgfmathfloat@a@E}%
+ \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}%
\pgfmath@smuggleone\pgfmathresult
\endgroup
}
+% Assigns \pgfmathresult to be a float encoded as
+% <FLAGS><MANTISSE>e<EXPONENT>
+%
+% example:
+% \pgfmathfloatcreate{1}{2.0}{10}
+% \pgfmathfloat@to@FMeE@style\pgfmathresult
+% ->
+% \pgfmathresult is now '12.0e10' regardless of the internal float
+% format.
+\def\pgfmathfloat@to@FMeE@style#1{\expandafter\pgfmathfloat@to@FMeE@style@#1\relax}%
+\def\pgfmathfloat@to@FMeE@style@#1Y#2e#3]\relax{\def\pgfmathresult{#1#2e#3}}%
% decomposes a lowlevel floating point representation into flags,
% mantisse and exponent.
@@ -122,22 +130,22 @@
% #4: integer register for the flags.
% #5: dimen registers for the mantisse.
% #6: integer register for the exponent.
-\def\pgfmathfloat@decompose#1#2e#3\relax#4#5#6{%
+\def\pgfmathfloat@decompose#1Y#2e#3]\relax#4#5#6{%
#4=#1\relax
#5=#2pt%
#6=#3\relax%
}
% overloaded, #5 needs to be a token register for the mantisse.
-\def\pgfmathfloat@decompose@tok#1#2e#3\relax#4#5#6{%
+\def\pgfmathfloat@decompose@tok#1Y#2e#3]\relax#4#5#6{%
#4=#1\relax
#5={#2}%
#6=#3\relax%
}
% overloaded, returns only ONE of the three components into #4:
-\def\pgfmathfloat@decompose@F#1#2e#3\relax#4{#4=#1\relax}%
-\def\pgfmathfloat@decompose@M#1#2e#3\relax#4{#4=#2pt}%
-\def\pgfmathfloat@decompose@Mtok#1#2e#3\relax#4{#4={#2}}%
-\def\pgfmathfloat@decompose@E#1#2e#3\relax#4{#4=#3\relax}%
+\def\pgfmathfloat@decompose@F#1Y#2e#3]\relax#4{#4=#1\relax}%
+\def\pgfmathfloat@decompose@M#1Y#2e#3]\relax#4{#4=#2pt}%
+\def\pgfmathfloat@decompose@Mtok#1Y#2e#3]\relax#4{#4={#2}}%
+\def\pgfmathfloat@decompose@E#1Y#2e#3]\relax#4{#4=#3\relax}%
% Takes a floating point number #1 as input and writes flags to macro
% #2, mantisse to macro #3 and exponent to macro #4.
@@ -187,525 +195,15 @@
%
% All arguments are characters and will be expanded using '\edef'.
\def\pgfmathfloatcreate#1#2#3{%
- \edef\pgfmathresult{#1#2e#3}%
-}%
-
-
-% Compares #1 with #2 and sets \pgfmathresult either to 1.0 or 0.0.
-%
-% 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
- \ifcase\pgfmathfloat@a@S
- % x = 0 -> (x<y <=> y >0)
- \ifnum1=\pgfmathfloat@b@S
- \global\pgfmathfloatcomparisontrue
- \fi
- \or
- % x > 0 -> (x<y <=> ( y > 0 && |x| < |y|) )
- \ifnum1=\pgfmathfloat@b@S
- % y>0:
- \pgfmathfloatlessthan@positive
- \fi
- \or
- % x < 0 -> (x<y <=> (y >= 0 || |x| > |y|) )
- \ifnum2=\pgfmathfloat@b@S
- % 'y<0':
- \pgfmathfloatgreaterthan@positive
- \else
- \global\pgfmathfloatcomparisontrue
- \fi
- \else
- \pgfmath@error{Sorry, 'pgfmathfloatlessthan@{#1}{#2}' not yet supported.}%
- \fi
- \endgroup
- \ifpgfmathfloatcomparison
- \def\pgfmathresult{1.0}%
- \else
- \def\pgfmathresult{0.0}%
- \fi
-}
-\let\pgfmathfloatlessthan=\pgfmathfloatlessthan@
-
-% compares \pgfmathfloat@a@[SME] < \pgfmathfloat@b@[SME]
-\def\pgfmathfloatlessthan@positive{%
- \ifnum\pgfmathfloat@a@E<\pgfmathfloat@b@E
- \global\pgfmathfloatcomparisontrue
- \else
- \ifnum\pgfmathfloat@a@E=\pgfmathfloat@b@E
- \ifdim\pgfmathfloat@a@M<\pgfmathfloat@b@M
- \global\pgfmathfloatcomparisontrue
- \fi
- \fi
- \fi
-}
-
-% compares \pgfmathfloat@a@[SME] > \pgfmathfloat@b@[SME]
-\def\pgfmathfloatgreaterthan@positive{%
- \ifnum\pgfmathfloat@a@E>\pgfmathfloat@b@E
- \global\pgfmathfloatcomparisontrue
- \else
- \ifnum\pgfmathfloat@a@E=\pgfmathfloat@b@E
- \ifdim\pgfmathfloat@a@M>\pgfmathfloat@b@M
- \global\pgfmathfloatcomparisontrue
- \fi
- \fi
- \fi
-}
-
-
-\def\pgfmathfloatmax@#1#2{%
- \pgfmathfloatlessthan{#1}{#2}%
- \ifpgfmathfloatcomparison
- \edef\pgfmathresult{#2}%
- \else
- \edef\pgfmathresult{#1}%
- \fi
-}
-\let\pgfmathfloatmax=\pgfmathfloatmax@
-
-\def\pgfmathfloatmin@#1#2{%
- \pgfmathfloatlessthan{#1}{#2}%
- \ifpgfmathfloatcomparison
- \edef\pgfmathresult{#1}%
- \else
- \edef\pgfmathresult{#2}%
- \fi
-}
-\let\pgfmathfloatmin=\pgfmathfloatmin@
-
-% Renormalizes #1 to extended precision mantisse, meaning
-% 100 <= m < 1000
-% instead of 1 <= m < 10.
-%
-% The 'extended precision' means we have higher accuracy when we apply pgfmath operations to mantisses.
-%
-% The input argument is expected to be a normalized floating point number; the output argument is a non-normalized floating point number (well, normalized to extended precision).
-%
-% The operation is supposed to be very fast.
-\def\pgfmathfloattoextentedprecision#1{%
- \begingroup
- \pgfmathfloattoextentedprecision@a{#1}%
- \pgfmathfloatcreate{\pgfmathfloat@a@S}{\pgfmathresult}{\pgfmathfloat@a@E}%
- \pgfmath@smuggleone\pgfmathresult
- \endgroup
-}%
-
-\def\pgfmathfloattoextentedprecision@@zero#1\pgfmathfloat@EOI{%
- \edef\pgfmathresult{#1}%
-}%
-\def\pgfmathfloattoextentedprecision@@one#1.#2#3\pgfmathfloat@EOI{%
- \edef\pgfmathresult{#1#2.#3}%
-}%
-\def\pgfmathfloattoextentedprecision@@two#1.#2#3#4\pgfmathfloat@EOI{%
- \edef\pgfmathresult{#1#2#3.#4}%
-}%
-
-% Sets extended precision to 10^#1.
-%
-% The default is 10^2, which means mantissas in extended precision are
-% normalised to 100 <= m < 1000.
-%
-% The case 10^1 means they are normalised to 10 <= m < 100 and 10^0
-% deactivates extended precision.
-%
-% #1 is the exponent, #1 = 0,1 or 2.
-%
-% This setting applies to \pgfmathfloattoextentedprecision.
-\def\pgfmathfloatsetextprecision#1{%
- \ifcase#1\relax
- \let\pgfmathfloattoextentedprecision@@=\pgfmathfloattoextentedprecision@@zero
- \def\pgfmathfloatextprec@shift{0}%
- \or
- \let\pgfmathfloattoextentedprecision@@=\pgfmathfloattoextentedprecision@@one
- \def\pgfmathfloatextprec@shift{1}%
- \else
- \let\pgfmathfloattoextentedprecision@@=\pgfmathfloattoextentedprecision@@two
- \def\pgfmathfloatextprec@shift{2}%
- \fi
+ \edef\pgfmathresult{#1Y#2e#3]}%
}%
-\pgfmathfloatsetextprecision{2}%
+% This is the character present in any low-level floating point
+% number. It is assumed to be the SECOND character of a float (after
+% the flags integer).
+\def\pgfmathfloat@POSTFLAGSCHAR{Y}
-% Does the same work as \pgfmathfloattoextentedprecision, but this one here fills the
-% registers \pgfmathfloat@a@S and \pgfmathfloat@a@E with the flags and (renormalized) exponent.
-% It destroys the content of \pgfmathfloat@a@Mtok.
-\def\pgfmathfloattoextentedprecision@a#1{%
- \expandafter\pgfmathfloat@decompose@tok#1\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 00\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
- \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
-}%
-
-% Addition of two floating point numbers using 8 significant digits.
-\def\pgfmathfloatadd@#1#2{%
- \begingroup
- %
- % renormalize argument to 100 <= m < 1000 for extended accuracy:
- \pgfmathfloattoextentedprecision@a{#1}%
- \let\pgfmathfloat@arga=\pgfmathresult
- %
- \pgfmathfloattoextentedprecision@b{#2}%
- \let\pgfmathfloat@argb=\pgfmathresult
- %
- \pgfmathfloatcomparisontrue% re-use this boolean here to handle special cases.
- \ifcase\pgfmathfloat@a@S
- \edef\pgfmathresult{#2}%
- \pgfmathfloatcomparisonfalse
- \or
- \or
- \edef\pgfmathfloat@arga{-\pgfmathfloat@arga}%
- \else
- \pgfmathfloatcomparisonfalse
- \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{0.0}{0}%
- \fi
- \ifcase\pgfmathfloat@b@S
- \edef\pgfmathresult{#1}%
- \pgfmathfloatcomparisonfalse
- \or
- \or
- \edef\pgfmathfloat@argb{-\pgfmathfloat@argb}%
- \else
- \pgfmathfloatcomparisonfalse
- \pgfmathfloatcreate{\the\pgfmathfloat@b@S}{0.0}{0}%
- \fi
- \ifpgfmathfloatcomparison
- % Shift lesser mantisse to fit the larger one:
- \ifnum\pgfmathfloat@a@E<\pgfmathfloat@b@E
- \pgfmathfloatadd@shift{\pgfmathfloat@arga}{\pgfmathfloat@a@E}{\pgfmathfloat@b@E}%
- \else
- \pgfmathfloatadd@shift{\pgfmathfloat@argb}{\pgfmathfloat@b@E}{\pgfmathfloat@a@E}%
- \fi
- % add them!
- \pgfmathadd@{\pgfmathfloat@arga}{\pgfmathfloat@argb}%
- % renormalize sum. This is the only part were an expensive routine comes into play:
- \edef\pgfmathresult{\pgfmathresult e\the\pgfmathfloat@a@E}%
- \expandafter\pgfmathfloatqparsenumber\expandafter{\pgfmathresult}%
- \fi
- \pgfmath@smuggleone\pgfmathresult
- \endgroup
-}%
-
-
-% #1=mantisse which needs to be shifted (with smaller exponent)
-% #2=smaller exponent
-% #3=larger exponent
-%
-% ATTENTION: this helper method DESTROYS contents of \pgfmathfloat@a@S.
-\def\pgfmathfloatadd@shift#1#2#3{%
- \pgf@xa=#1 pt%
- \pgfmathfloat@a@S=#3\relax
- \advance\pgfmathfloat@a@S by-#2\relax
- \ifcase\pgfmathfloat@a@S
- \or
- \divide\pgf@xa by10\relax
- \or
- \divide\pgf@xa by100\relax
- \or
- \divide\pgf@xa by1000\relax
- \or
- \divide\pgf@xa by10000\relax
- \or
- \divide\pgf@xa by10000\relax
- \divide\pgf@xa by10\relax
- \or
- \divide\pgf@xa by10000\relax
- \divide\pgf@xa by100\relax
- \or
- \divide\pgf@xa by10000\relax
- \divide\pgf@xa by1000\relax
- \or
- \divide\pgf@xa by10000\relax
- \divide\pgf@xa by10000\relax
- \else
- \pgf@xa=0pt%
- \fi
- #2=#3\relax
- \edef#1{\pgf@sys@tonumber\pgf@xa}%
-}
-
-\let\pgfmathfloatadd=\pgfmathfloatadd@
-
-
-% 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
- \ifcase\pgfmathfloat@b@S
- \edef\pgfmathresult{#1}%
- \or
- \pgfmathfloatcreate{2}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@b@E}%
- \let\pgfmathfloatsub@arg=\pgfmathresult
- \pgfmathfloatadd@{#1}{\pgfmathfloatsub@arg}%
- \or
- \pgfmathfloatcreate{1}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@b@E}%
- \let\pgfmathfloatsub@arg=\pgfmathresult
- \pgfmathfloatadd@{#1}{\pgfmathfloatsub@arg}%
- \else
- \pgfmathfloatcreate{\the\pgfmathfloat@b@S}{0.0}{0}%
- \fi
- \pgfmath@smuggleone\pgfmathresult
- \endgroup
-}%
-
-\let\pgfmathfloatsubtract=\pgfmathfloatsubtract@
-
-% Scales a floating point number #1 with a fixed point number #2 using pgfmathmultiply.
-%
-% Use this method if #2 is small number.
-\def\pgfmathfloatmultiplyfixed@#1#2{%
- \begingroup
- %
- % renormalize argument to 100 <= m < 1000 for extended accuracy:
- \pgfmathfloattoextentedprecision@a{#1}%
- \let\pgfmathfloat@arga=\pgfmathresult
- %
- \pgfmathfloatcomparisontrue% re-use this boolean here to handle special cases.
- \ifcase\pgfmathfloat@a@S
- \edef\pgfmathresult{#1}%
- \pgfmathfloatcomparisonfalse
- \or
- \or
- \edef\pgfmathfloat@arga{-\pgfmathfloat@arga}%
- \else
- \pgfmathfloatcomparisonfalse
- \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{0.0}{0}%
- \fi
- \ifpgfmathfloatcomparison
- \pgfmathmultiply@{\pgfmathfloat@arga}{#2}%
- % renormalize product. This is the only part were an expensive routine comes into play:
- \edef\pgfmathresult{\pgfmathresult e\the\pgfmathfloat@a@E}%
- \expandafter\pgfmathfloatqparsenumber\expandafter{\pgfmathresult}%
- \fi
- \pgfmath@smuggleone\pgfmathresult
- \endgroup
-}%
-
-\let\pgfmathfloatmultiplyfixed=\pgfmathfloatmultiplyfixed@
-
-
-\def\pgfmathfloatmultiply@#1#2{%
- \begingroup
- \pgfmathfloatsetextprecision{1}%
- \pgfmathfloattoextentedprecision@a{#1}%
- \let\pgfmathfloat@arga=\pgfmathresult
- %
- \pgfmathfloattoextentedprecision@b{#2}%
- \let\pgfmathfloat@argb=\pgfmathresult
- %
- \pgfmathfloatcomparisontrue% re-use this boolean here to handle special cases.
- \ifcase\pgfmathfloat@a@S
- % 0
- \pgfmathfloatcreate{0}{0.0}{0}%
- \pgfmathfloatcomparisonfalse
- \or% +
- \ifcase\pgfmathfloat@b@S
- \pgfmathfloatcreate{0}{0.0}{0}%
- \pgfmathfloatcomparisonfalse
- \or
- \def\pgfmathresult@S{1}%
- \or
- \def\pgfmathresult@S{2}%
- \else
- \expandafter\pgfmathfloatcreate\the\pgfmathfloat@b@S{0.0}{0}%
- \pgfmathfloatcomparisonfalse
- \fi
- \or% -
- \ifcase\pgfmathfloat@b@S
- \pgfmathfloatcreate{0}{0.0}{0}%
- \pgfmathfloatcomparisonfalse
- \or
- \def\pgfmathresult@S{2}%
- \or
- \def\pgfmathresult@S{1}%
- \or
- \pgfmathfloatcreate{3}{0.0}{0}%
- \pgfmathfloatcomparisonfalse
- \or
- \pgfmathfloatcreate{5}{0.0}{0}%
- \pgfmathfloatcomparisonfalse
- \or
- \pgfmathfloatcreate{4}{0.0}{0}%
- \pgfmathfloatcomparisonfalse
- \fi
- \or% nan
- \pgfmathfloatcreate{3}{0.0}{0}%
- \pgfmathfloatcomparisonfalse
- \or% +infty
- \ifcase\pgfmathfloat@b@S
- \pgfmathfloatcreate{0}{0.0}{0}%
- \pgfmathfloatcomparisonfalse
- \or
- \pgfmathfloatcreate{4}{0.0}{0}%
- \pgfmathfloatcomparisonfalse
- \or
- \pgfmathfloatcreate{5}{0.0}{0}%
- \pgfmathfloatcomparisonfalse
- \or
- \pgfmathfloatcreate{3}{0.0}{0}%
- \pgfmathfloatcomparisonfalse
- \or
- \pgfmathfloatcreate{4}{0.0}{0}%
- \pgfmathfloatcomparisonfalse
- \or
- \pgfmathfloatcreate{5}{0.0}{0}%
- \pgfmathfloatcomparisonfalse
- \fi
- \or% -infty
- \ifcase\pgfmathfloat@b@S
- \pgfmathfloatcreate{0}{0.0}{0}%
- \pgfmathfloatcomparisonfalse
- \or
- \pgfmathfloatcreate{5}{0.0}{0}%
- \pgfmathfloatcomparisonfalse
- \or
- \pgfmathfloatcreate{4}{0.0}{0}%
- \pgfmathfloatcomparisonfalse
- \or
- \pgfmathfloatcreate{3}{0.0}{0}%
- \pgfmathfloatcomparisonfalse
- \or
- \pgfmathfloatcreate{5}{0.0}{0}%
- \pgfmathfloatcomparisonfalse
- \or
- \pgfmathfloatcreate{4}{0.0}{0}%
- \pgfmathfloatcomparisonfalse
- \fi
- \fi
- \ifpgfmathfloatcomparison
- \pgfmathmultiply@{\pgfmathfloat@arga}{\pgfmathfloat@argb}%
- \advance\pgfmathfloat@a@E by\pgfmathfloat@b@E
- % renormalize sum. This is the only part were an expensive routine comes into play:
- \edef\pgfmathresult{\pgfmathresult e\the\pgfmathfloat@a@E}%
- \expandafter\pgfmathfloatqparsenumber\expandafter{\pgfmathresult}%
- \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
- \pgfmathfloatcreate{\pgfmathresult@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}%
- \fi
- \pgfmath@smuggleone\pgfmathresult
- \endgroup
-}%
-\let\pgfmathfloatmultiply=\pgfmathfloatmultiply@
-
-\def\pgfmathfloatdivide@#1#2{%
- \begingroup
- \pgfmathfloatsetextprecision{1}%
- \pgfmathfloattoextentedprecision@a{#1}%
- \let\pgfmathfloat@arga=\pgfmathresult
- %
- \pgfmathfloattoextentedprecision@b{#2}%
- \let\pgfmathfloat@argb=\pgfmathresult
- %
- \pgfmathfloatcomparisontrue% re-use this boolean here to handle special cases.
- \ifcase\pgfmathfloat@a@S
- % 0
- \pgfmathfloatcreate{0}{0.0}{0}%
- \pgfmathfloatcomparisonfalse
- \or% +
- \ifcase\pgfmathfloat@b@S
- \pgfmathfloatcreate{4}{0.0}{0}%
- \pgfmathfloatcomparisonfalse
- \or
- \def\pgfmathresult@S{1}%
- \or
- \def\pgfmathresult@S{2}%
- \or
- \pgfmathfloatcreate{3}{0.0}{0}%
- \pgfmathfloatcomparisonfalse
- \else
- \pgfmathfloatcreate{0}{0.0}{0}%
- \pgfmathfloatcomparisonfalse
- \fi
- \or% -
- \ifcase\pgfmathfloat@b@S
- \pgfmathfloatcreate{5}{0.0}{0}%
- \pgfmathfloatcomparisonfalse
- \or
- \def\pgfmathresult@S{2}%
- \or
- \def\pgfmathresult@S{1}%
- \or
- \pgfmathfloatcreate{3}{0.0}{0}%
- \pgfmathfloatcomparisonfalse
- \else
- \pgfmathfloatcreate{0}{0.0}{0}%
- \pgfmathfloatcomparisonfalse
- \fi
- \or% nan
- \pgfmathfloatcreate{3}{0.0}{0}%
- \pgfmathfloatcomparisonfalse
- \or% +infty
- \ifcase\pgfmathfloat@b@S
- \pgfmathfloatcreate{4}{0.0}{0}%
- \pgfmathfloatcomparisonfalse
- \or
- \pgfmathfloatcreate{4}{0.0}{0}%
- \pgfmathfloatcomparisonfalse
- \or
- \pgfmathfloatcreate{5}{0.0}{0}%
- \pgfmathfloatcomparisonfalse
- \or
- \pgfmathfloatcreate{3}{0.0}{0}%
- \pgfmathfloatcomparisonfalse
- \or
- \pgfmathfloatcreate{4}{0.0}{0}% what is inf/inf ?
- \pgfmathfloatcomparisonfalse
- \or
- \pgfmathfloatcreate{5}{0.0}{0}% or inf/-inf ?
- \pgfmathfloatcomparisonfalse
- \fi
- \or% -infty
- \ifcase\pgfmathfloat@b@S
- \pgfmathfloatcreate{5}{0.0}{0}%
- \pgfmathfloatcomparisonfalse
- \or
- \pgfmathfloatcreate{5}{0.0}{0}%
- \pgfmathfloatcomparisonfalse
- \or
- \pgfmathfloatcreate{4}{0.0}{0}%
- \pgfmathfloatcomparisonfalse
- \or
- \pgfmathfloatcreate{3}{0.0}{0}%
- \pgfmathfloatcomparisonfalse
- \or
- \pgfmathfloatcreate{5}{0.0}{0}%
- \pgfmathfloatcomparisonfalse
- \or
- \pgfmathfloatcreate{4}{0.0}{0}%
- \pgfmathfloatcomparisonfalse
- \fi
- \fi
- \ifpgfmathfloatcomparison
- \pgfmathdivide@{\pgfmathfloat@arga}{\pgfmathfloat@argb}%
- \advance\pgfmathfloat@a@E by-\pgfmathfloat@b@E
- % renormalize sum. This is the only part were an expensive routine comes into play:
- \edef\pgfmathresult{\pgfmathresult e\the\pgfmathfloat@a@E}%
- \expandafter\pgfmathfloatqparsenumber\expandafter{\pgfmathresult}%
- \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
- \pgfmathfloatcreate{\pgfmathresult@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}%
- \fi
- \pgfmath@smuggleone\pgfmathresult
- \endgroup
-}%
-\let\pgfmathfloatdivide=\pgfmathfloatdivide@
-
% Converts a composed floating point representation to fixed point.
%
% Example:
@@ -720,7 +218,8 @@
\expandafter\pgfmathfloattofixed@impl\the\pgfmathfloat@a@Mtok\relax
\or
\expandafter\pgfmathfloattofixed@impl\the\pgfmathfloat@a@Mtok\relax
- \edef\pgfmathresult{-\pgfmathresult}%
+ \pgfmathfloat@a@Mtok=\expandafter{\pgfmathresult}%
+ \edef\pgfmathresult{-\the\pgfmathfloat@a@Mtok}%
\or\def\pgfmathresult{nan}%
\or\def\pgfmathresult{inf}%
\or\def\pgfmathresult{-inf}%
@@ -751,127 +250,6 @@
}%
\let\pgfmathfloattosci=\pgfmathfloattosci@
-% Divides or multiplies the input number by 10^#4 using an arithmetic
-% left/right shift.
-%
-% Input:
-% #1 a normalised floating point number.
-% #2 a positive or negative integer number denoting the shift.
-%
-% Example:
-% \pgfmathfloatshift{11e3}{4}%
-% -> pgfmathresult = 11e7
-\def\pgfmathfloatshift@#1#2{%
- \begingroup
- \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
- \expandafter\advance\expandafter\pgfmathfloat@a@E#2\relax
- \edef\pgfmathresult{\the\pgfmathfloat@a@S\the\pgfmathfloat@a@Mtok e\the\pgfmathfloat@a@E}%
- \pgfmath@smuggleone\pgfmathresult
- \endgroup
-}
-\let\pgfmathfloatshift=\pgfmathfloatshift@
-
-% Computes a good guess for log(X.XXXX) where the input number should
-% be between 0 < x < 10.
-%
-% If it is not in this range, the returned value will be bad.
-%
-% For use in the newton implementation of log(x). Please note that we
-% first compute a normalized floating point representation of x, and
-% the mantisse is always between 0 and 10.
-\def\pgfmathlog@smaller@ten@newton@startval#1.#2\to#3{%
- \ifcase#1
- \pgfmath@error{pgfmathlog@newton: INTERNAL ERROR: should not happen!
- [\#1=0 should have been caught before!]}%
- \or#3=0.530628pt
- \or#3=0.993pt
- \or#3=1.308pt
- \or#3=1.5pt
- \or#3=1.71pt
- \or#3=1.872pt
- \or#3=2.01pt
- \or#3=2.145pt
- \or#3=2.24pt
- \fi
-}
-
-% FIXME : eliminate \pgfmathlog@invoke@expanded ?
-
-% Expands #2 using \edef and invokes #1 with the resulting string.
-%
-% Example:
-% \pgfmath@y=7.9pt
-% \pgfmathlog@invoke@expanded\pgfmathexp@{{\pgf@sys@tonumber{\pgfmath@y}}}%
-% will invoke
-% \pgfmathexp@{7.9}
-\def\pgfmathlog@invoke@expanded#1#2{%
- \edef\pgfmath@resulttemp{#2}%
- \expandafter#1\pgfmath@resulttemp
-}
-
-% This implementation of log(X) is done with a newton method applied to x-exp(y) = 0.
-% The implementation \pgfmathexp is used for exp(y).
-%
-% see \pgfmathlog@
-\def\pgfmathlog@newton#1{%
- \pgfmathfloatparsenumber{#1}%
- \pgfmathlog@newton@float{\pgfmathresult}%
-}
-
-% the same as \pgfmathlog@newton, but this one takes a floating point number as input.
-\def\pgfmathlog@newton@float#1{%
- \begingroup%
- % compute #1 = M*10^E with normalised mantisse M = [+-]*[1-9].XXXXX
- \expandafter\pgfmathfloat@decompose#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@M\pgfmathfloat@a@E
- \let\pgfmathlog@loopcount=\pgfmathfloat@b@S% this counter is not used here... use it as loop counter.
- %
- \ifnum\pgfmathfloat@a@S=1
- % Now, compute log(#1) = log(M) + E*log(10)
- \expandafter\pgfmathlog@smaller@ten@newton@startval\the\pgfmathfloat@a@M.\to\pgfmathfloat@b@M
- \pgfmathlog@loopcount=0
- \pgfutil@loop
- \ifnum\pgfmathlog@loopcount<3
- \pgfmathlog@invoke@expanded\pgfmathexp@{{\pgf@sys@tonumber{\pgfmathfloat@b@M}}}%
- \let\pgfmathlog@tmp=\pgfmathresult
- \pgfmathlog@invoke@expanded\pgfmathdivide@{{\pgf@sys@tonumber{\pgfmathfloat@a@M}}{\pgfmathlog@tmp}}%
- \expandafter\pgfmath@ya\pgfmathresult pt
- \advance\pgfmathfloat@b@M by\pgfmath@ya
- \advance\pgfmathfloat@b@M by-1pt
- \advance\pgfmathlog@loopcount by1
- \pgfutil@repeat
- \pgfmathfloat@a@M=2.302585pt% = log(10)
- \multiply\expandafter\pgfmathfloat@a@M\pgfmathfloat@a@E
- \advance\pgfmathfloat@b@M by\pgfmathfloat@a@M
- \edef\pgfmathresult{\pgf@sys@tonumber{\pgfmathfloat@b@M}}%
- \else
- \let\pgfmathresult=\pgfutil@empty%
- \fi
- \pgfmath@smuggleone\pgfmathresult
- \endgroup%
-}
-
-% Computes log(x) into \pgfmathresult.
-%
-% REMARK
-% This method does NOT use TeX Registers to represent the numbers! The
-% computation is COMPLETELY STRING BASED.
-% This allows numbers such at 10000000 or 5.23e-10 to be represented
-% properly, although TeX-registers would produce overflow/underflow
-% errors in these cases.
-%
-% The natural logarithm is computed using log(X*10^Y) = log(X) + log(10)*Y
-\let\pgfmathlog@=\pgfmathlog@newton
-
-\let\pgfmathlog@float=\pgfmathlog@newton@float
-
-% Public interface method. This is expected to use \pgfmathparse but
-% it DOESN'T do that. \pgfmathparse naturally can't handle numbers
-% which exceed TeX's numerical capabilities. However, exponentials are
-% typically either too large or too small for TeX.
-%
-% @see \pgfmathnormalisedfloatingpoint for how we parse arguments.
-% @see \pgfmathlog@
-\let\pgfmathlog=\pgfmathlog@newton
% Rounds a fixed point number #1 to \pgfmathfloat@round@precision digits precision and returns
% the result into \pgfmathresult.
@@ -891,7 +269,7 @@
% -> \pgfmathresult = '20000'
%
% Arguments:
-% #1 may be either a number or a macro expanding to a number.
+% #1 may be either a number or a macro (\pgfmathresult is allowed) expanding to a number.
%
% SIDE EFFECT: the global variable \ifpgfmathfloatroundhasperiod will be set.
\def\pgfmathroundto#1{%
@@ -984,15 +362,20 @@
\def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{%
\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printall}%
\else
- \advance\c@pgf@counta by1% counta:= total number of digits, N.
- \c@pgf@countb=\c@pgf@counta
- \divide\c@pgf@countb by3% countb := N DIV 3
- \c@pgf@countc=\c@pgf@countb
- \multiply\c@pgf@countc by3
- \advance\c@pgf@counta by-\c@pgf@countc% now counta := N MOD 3
- \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{%
- \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printsign
- }%
+ \ifnum\c@pgf@counta<\pgfkeysvalueof{/pgf/number format/min exponent for 1000 sep}\relax
+ \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{%
+ \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printall}%
+ \else
+ \advance\c@pgf@counta by1 % counta:= total number of digits, N.
+ \c@pgf@countb=\c@pgf@counta
+ \divide\c@pgf@countb by3 % countb := N DIV 3
+ \c@pgf@countc=\c@pgf@countb
+ \multiply\c@pgf@countc by3
+ \advance\c@pgf@counta by-\c@pgf@countc% now counta := N MOD 3
+ \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{%
+ \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printsign
+ }%
+ \fi
\fi
\fi
\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT
@@ -1069,7 +452,7 @@
% \def\pgfmathfloat@loc@TMPc{#1#2#3}%
% \ifx\pgfmathfloat@loc@TMPc\pgfmathfloat@loc@TMPb
% \else
- % \pgfmath@error{INTERNAL ERROR in fixed style - The input sequence did not terminate as expected; which indicates a wrong exponent argument provided to \string\pgfmathprintnumber@fixed@style}%
+ % \pgfmath@error{INTERNAL ERROR in fixed style - The input sequence did not terminate as expected; which indicates a wrong exponent argument provided to \string\pgfmathprintnumber@fixed@style}{}%
% \fi
%--------------------------------------------------
\let\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT=\relax
@@ -1120,7 +503,9 @@
% Input:
% #1 the fixed point number to be displayed (maybe a macro).
-% #2#3e#4: the (possibly unformatted) floating point representation which belongs to #1.
+% #2#3e#4: the (possibly unformatted) floating point representation
+% which belongs to #1. This format is returned (only!) by
+% \pgfmathfloat@to@FMeE@style.
% It is used to determine sign and exponent.
\let\pgfmathprintnumber@fixed@style=\pgfmathprintnumber@fixed@styleDEFAULT
@@ -1182,15 +567,15 @@
\or\pgfmathprintnumber@fixed@style{-#2}#1#2e0\relax%
\expandafter\pgfmathfloatrounddisplaystyle@shared@impl@\expandafter{\pgfmathresult}{#4#6}%
\or
- \pgfmathfloatrounddisplaystyle@shared@impl@{NaN}{}%
+ \pgfmathfloatrounddisplaystyle@shared@impl@@{NaN}{}%
\or
\ifpgfmathprintnumber@showpositive
- \pgfmathfloatrounddisplaystyle@shared@impl@{+\infty}{}%
+ \pgfmathfloatrounddisplaystyle@shared@impl@@{+\infty}{}%
\else
- \pgfmathfloatrounddisplaystyle@shared@impl@{\infty}{}%
+ \pgfmathfloatrounddisplaystyle@shared@impl@@{\infty}{}%
\fi
\or
- \pgfmathfloatrounddisplaystyle@shared@impl@{-\infty}{}%
+ \pgfmathfloatrounddisplaystyle@shared@impl@@{-\infty}{}%
\fi
}
@@ -1203,6 +588,17 @@
}%
\let\pgfmathresult=\pgfmathfloat@glob@TMP
}%
+% Same as \pgfmathfloatrounddisplaystyle@shared@impl@, but it also
+% inserts the '@dec sep mark' at the end.
+\def\pgfmathfloatrounddisplaystyle@shared@impl@@#1#2{%
+ {\toks0={#1}%
+ \toks1=\expandafter{\pgfmathfloatrounddisplaystyle@e@mark #2}%
+ \pgfkeysgetvalue{/pgf/number format/@dec sep mark}\pgfmathprintnumber@fixed@styleDEFAULT@DEC@SEP@MARK
+ \toks2=\expandafter{\pgfmathprintnumber@fixed@styleDEFAULT@DEC@SEP@MARK}%
+ \xdef\pgfmathfloat@glob@TMP{\the\toks0 \the\toks1 \the\toks2 }%
+ }%
+ \let\pgfmathresult=\pgfmathfloat@glob@TMP
+}
\def\pgfmathfloatrounddisplaystyle@std#1#2e#3\relax{%
\pgfmathfloatrounddisplaystyle@shared@impl#1#2e#3\relax{\cdot}{}{10^{#3}}%
@@ -1210,6 +606,9 @@
\def\pgfmathfloatrounddisplaystyle@subscript#1#2e#3\relax{%
\pgfmathfloatrounddisplaystyle@shared@impl#1#2e#3\relax{}{1}{_{#3}}%
}
+\def\pgfmathfloatrounddisplaystyle@superscript#1#2e#3\relax{%
+ \pgfmathfloatrounddisplaystyle@shared@impl#1#2e#3\relax{}{1}{^{#3}}%
+}
\def\pgfmathfloatrounddisplaystyle@e#1#2e#3\relax{%
\ifnum#3<0\relax
{\count0=#3\relax
@@ -1237,7 +636,7 @@
\expandafter\pgfmathfloat@loc@TMPb\expandafter{\pgfmathresult}%
}
-% A macro which takes three arguments, sign, mantisse and exponent and
+% A macro which takes the argument '<SIGN><MANTISSE>e<EXPONENT>' and
% expands to the final TeX-representation for that floating point
% number.
%
@@ -1245,9 +644,8 @@
% the floating point number has already been rounded properly and
% the mantisse has been rounded correcty.
%
-% #1: SIGN
-% #2: MANTISSE
-% #3: EXPONENT
+% The argument needs to be in the format returned by
+% \pgfmathfloat@to@FMeE@style and terminated by '\relax'.
\let\pgfmathfloatrounddisplaystyle=\pgfmathfloatrounddisplaystyle@std
\newif\ifpgfmathfloat@usezerofill@sci
\newif\ifpgfmathfloat@usezerofill@fixed
@@ -1278,6 +676,7 @@
@sci exponent mark/.initial=,
set thousands separator/.initial=,
1000 sep/.style={/pgf/number format/set thousands separator=#1},
+ min exponent for 1000 sep/.initial=0,
use period/.style= {/pgf/number format/set decimal separator={.},/pgf/number format/set thousands separator={{{,}}}},
use comma/.style= {/pgf/number format/set decimal separator={{{,}}},/pgf/number format/set thousands separator={.}},
showpos/.is if=pgfmathprintnumber@showpositive,
@@ -1293,6 +692,7 @@
sci e/.code= {\let\pgfmathfloatrounddisplaystyle=\pgfmathfloatrounddisplaystyle@e},
sci E/.code= {\let\pgfmathfloatrounddisplaystyle=\pgfmathfloatrounddisplaystyle@E},
sci subscript/.code= {\let\pgfmathfloatrounddisplaystyle=\pgfmathfloatrounddisplaystyle@subscript},
+ sci superscript/.code= {\let\pgfmathfloatrounddisplaystyle=\pgfmathfloatrounddisplaystyle@superscript},
% sci may skip mantisse/.is if=pgfmathfloatround@allow@empty@mantisse,
% sci may skip mantisse/.default=true,
}
@@ -1302,6 +702,7 @@
\def\pgfmathprintnumber@STD#1{%
% parse the input:
\pgfmathfloatparsenumber{#1}%
+ \pgfmathfloat@to@FMeE@style\pgfmathresult
\expandafter\pgfmathprintnumber@STD@issci\pgfmathresult\relax
}
@@ -1329,6 +730,7 @@
\def\pgfmathprintnumber@INT@TRUNC#1{%
\pgfmathfloatparsenumber{#1}%
+ \pgfmathfloat@to@FMeE@style\pgfmathresult
\expandafter\pgfmathprintnumber@INT@TRUNC@issci\pgfmathresult\relax
}
@@ -1338,7 +740,8 @@
}
\def\pgfmathprintnumber@INT@TRUNC@issci#1#2e#3\relax{%
\ifnum#1<3\relax
- \pgfmathfloattofixed{#1#2e#3}%
+ \pgfmathfloatcreate{#1}{#2}{#3}%
+ \pgfmathfloattofixed{\pgfmathresult}%
\expandafter\pgfmathprintnumber@INT@TRUNC@impl\pgfmathresult\relax#1#2e#3\relax
\else
\pgfmathfloatrounddisplaystyle#1#2e#3\relax%
@@ -1348,13 +751,15 @@
\def\pgfmathprintnumber@INT@DETECT#1{%
\pgfmathfloatparsenumber{#1}%
+ \pgfmathfloat@to@FMeE@style\pgfmathresult
\expandafter\pgfmathprintnumber@INT@DETECT@issci\pgfmathresult\relax
}
\def\pgfmathprintnumber@INT@DETECT@issci#1#2e#3\relax{%
\begingroup
\ifnum#1<3\relax
- \pgfmathfloattofixed{#1#2e#3}%
+ \pgfmathfloatcreate{#1}{#2}{#3}%
+ \pgfmathfloattofixed{\pgfmathresult}%
\def\pgfmathfloat@round@precision{6}%
\expandafter\pgfmathroundto\expandafter{\pgfmathresult}%
\ifpgfmathfloatroundhasperiod
@@ -1371,13 +776,15 @@
\def\pgfmathprintnumber@FIXED#1{%
\pgfmathfloatparsenumber{#1}%
+ \pgfmathfloat@to@FMeE@style\pgfmathresult
\expandafter\pgfmathprintnumber@FIXED@issci\pgfmathresult\relax
}
\def\pgfmathprintnumber@FIXED@issci#1#2e#3\relax{%
\begingroup
\ifnum#1<3
- \pgfmathfloattofixed{#1#2e#3}%
+ \pgfmathfloatcreate{#1}{#2}{#3}%
+ \pgfmathfloattofixed{\pgfmathresult}%
\ifpgfmathfloat@usezerofill@fixed
\expandafter\pgfmathroundtozerofill\expandafter{\pgfmathresult}%
\else
@@ -1401,15 +808,18 @@
\def\pgfmathprintnumber@SCI#1{%
\pgfmathfloatparsenumber{#1}%
+ \pgfmathfloat@to@FMeE@style\pgfmathresult
\expandafter\pgfmathprintnumber@SCI@issci\pgfmathresult\relax
}
\def\pgfmathprintnumber@SCI@issci#1#2e#3\relax{%
+ \pgfmathfloatcreate{#1}{#2}{#3}%
\ifpgfmathfloat@usezerofill@sci
- \pgfmathfloatroundzerofill{#1#2e#3}%
+ \pgfmathfloatroundzerofill{\pgfmathresult}%
\else
- \pgfmathfloatround{#1#2e#3}%
+ \pgfmathfloatround{\pgfmathresult}%
\fi
+ \pgfmathfloat@to@FMeE@style\pgfmathresult
\expandafter\pgfmathfloatrounddisplaystyle\pgfmathresult\relax
}
@@ -1426,6 +836,7 @@
\def\pgfmathprintnumber@noopt#1{%
\pgfmathprintnumber@{#1}%
\ifpgfmathprintnumber@assumemathmode
+ \pgfmathresult
\else
\pgfutilensuremath{\pgfmathresult}%
\fi
@@ -1435,6 +846,7 @@
\pgfqkeys{/pgf/number format}{#1}%
\pgfmathprintnumber@{#2}%
\ifpgfmathprintnumber@assumemathmode
+ \pgfmathresult
\else
\pgfutilensuremath{\pgfmathresult}%
\fi
@@ -1519,12 +931,12 @@
% current TeX group.
% \ifpgfmathfloatroundmayneedrenormalize will be set globally
\def\pgfmathroundto@impl#1{%
+ \edef\pgfmathround@input{#1}%
\global\pgfmathfloatroundmayneedrenormalizefalse
\pgfmathfloat@tmptoks={}%
\let\pgfmathround@next=\pgfutil@empty
\let\pgfmathround@cur=\pgfutil@empty
\let\pgfmathresult=\pgfutil@empty
- \edef\pgfmathround@input{#1}%
\expandafter\c@pgfmathroundto@prec\pgfmathfloat@round@precision\relax
\c@pgfmathroundto@lastzeros=0
\c@pgfmathroundto@offsetbehindperiod=-1 % means: no period found so far
@@ -1628,14 +1040,14 @@
\fi
\else
%\ifnum\c@pgfmathroundto@offsetbehindperiod>\c@pgfmathroundto@prec
- % \pgfmath@error{Internal logic error in pgfmathroundto at [I] - should not have happened!?}%
+ % \pgfmath@error{Internal logic error in pgfmathroundto at [I] - should not have happened!?}{}%
%\fi
\pgfmathroundto@impl@finish@with@truncation
\fi
\else
%\ifnum\c@pgfmathroundto@offsetbehindperiod=\c@pgfmathroundto@prec
%\else
- % \pgfmath@error{Internal logic error in pgfmathroundto at [II] - should not have happened!? I have offsetbehindperiod=\the\c@pgfmathroundto@offsetbehindperiod and prec = \the\c@pgfmathroundto@prec}%
+ % \pgfmath@error{Internal logic error in pgfmathroundto at [II] - should not have happened!? I have offsetbehindperiod=\the\c@pgfmathroundto@offsetbehindperiod and prec = \the\c@pgfmathroundto@prec}{}%
%\fi
\expandafter\ifnum\pgfmathround@next<5\relax
\pgfmathroundto@impl@finish@with@truncation
@@ -1909,7 +1321,7 @@
\fi
\advance\pgfmathfloat@a@E by1
\fi
- \edef\pgfmathresult{\the\pgfmathfloat@a@S\pgfmathresult e\the\pgfmathfloat@a@E}%
+ \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\pgfmathresult}{\the\pgfmathfloat@a@E}%
}
\def\pgfmathfloatround@impl@renormalize#1#2.#3\pgfmathfloat@EOI{%
@@ -1924,12 +1336,36 @@
% collects everything into \pgfmathresult
\def\pgfmathfloattofixed@impl#1.#2\relax{%
\ifnum\pgfmathfloat@a@E<0
- \pgfmathfloat@a@Mtok={0.}%
- \pgfutil@loop
- \ifnum\pgfmathfloat@a@E<-1
- \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok 0}%
- \advance\pgfmathfloat@a@E by1
- \pgfutil@repeat
+ \ifcase-\pgfmathfloat@a@E
+ \or%e-1
+ \pgfmathfloat@a@Mtok={0.}%
+ \or%e-2
+ \pgfmathfloat@a@Mtok={0.0}%
+ \or%e-3
+ \pgfmathfloat@a@Mtok={0.00}%
+ \or%e-4
+ \pgfmathfloat@a@Mtok={0.000}%
+ \or%e-5
+ \pgfmathfloat@a@Mtok={0.0000}%
+ \or%e-6
+ \pgfmathfloat@a@Mtok={0.00000}%
+ \or%e-7
+ \pgfmathfloat@a@Mtok={0.000000}%
+ \or%e-8
+ \pgfmathfloat@a@Mtok={0.0000000}%
+ \or%e-9
+ \pgfmathfloat@a@Mtok={0.00000000}%
+ \or%e-10
+ \pgfmathfloat@a@Mtok={0.000000000}%
+ \else%<= -11
+ \pgfmathfloat@a@Mtok={0.0000000000}%
+ \advance\pgfmathfloat@a@E by10
+ \pgfutil@loop
+ \ifnum\pgfmathfloat@a@E<-1
+ \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok 0}%
+ \advance\pgfmathfloat@a@E by1
+ \pgfutil@repeat
+ \fi
\def\pgfmathfloat@loc@TMPb{#2}%
\def\pgfmathfloat@loc@TMPc{0}%
\ifx\pgfmathfloat@loc@TMPb\pgfmathfloat@loc@TMPc
@@ -1938,15 +1374,48 @@
\edef\pgfmathresult{\the\pgfmathfloat@a@Mtok #1#2}%
\fi
\else
- \ifnum\pgfmathfloat@a@E=0%
- \edef\pgfmathresult{#1.#2}%
- \else
- \pgfmathfloat@a@Mtok={#1}%
- \pgfmathfloattofixed@impl@collectmantisse#2\count\pgfmathfloat@a@E
- \edef\pgfmathresult{\the\pgfmathfloat@a@Mtok}%
- \fi
+ %--------------------------------------------------
+ % \ifnum\pgfmathfloat@a@E=0%
+ % \edef\pgfmathresult{#1.#2}%
+ % \else
+ % \pgfmathfloat@a@Mtok={#1}%
+ % \pgfmathfloattofixed@impl@collectmantisse#2\count\pgfmathfloat@a@E
+ % \edef\pgfmathresult{\the\pgfmathfloat@a@Mtok}%
+ % \fi
+ %--------------------------------------------------
+ \pgfmathfloat@a@Mtok{#1}%
+ \pgfmathfloattofixed@impl@pos#2000000000\pgfmathfloat@EOI
+ \edef\pgfmathresult{\the\pgfmathfloat@a@Mtok}%
+ \fi
+}
+
+% FIXME: this implementation here is very fast, but it introduces trailing zeros. Is that acceptable?
+\def\pgfmathfloattofixed@impl@pos#1#2#3#4#5#6#7#8#9\pgfmathfloat@EOI{%
+ \ifcase\pgfmathfloat@a@E
+ % e+0
+ \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok .#1#2#3#4#5#6#7#8#9}%
+ \or%e+1
+ \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1.#2#3#4#5#6#7#8#9}%
+ \or%e+2
+ \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1#2.#3#4#5#6#7#8#9}%
+ \or%e+3
+ \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1#2#3.#4#5#6#7#8#9}%
+ \or%e+4
+ \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1#2#3#4.#5#6#7#8#9}%
+ \or%e+5
+ \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1#2#3#4#5.#6#7#8#9}%
+ \or%e+6
+ \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1#2#3#4#5#6.#7#8#9}%
+ \or%e+7
+ \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1#2#3#4#5#6#7.#8#9}%
+ \or%e+8
+ \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1#2#3#4#5#6#7#8.#9}%
+ \else%>=9
+ \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1#2#3#4#5#6#7#8}%
+ \advance\pgfmathfloat@a@E by-8
+ \pgfmathfloattofixed@impl@collectmantisse#9\count\pgfmathfloat@a@E
\fi
-}
+}%
\def\pgfmathfloattofixed@impl@collectmantisse#1#2\count#3{%
\pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok #1}%
@@ -1977,117 +1446,124 @@
%
% ============================================
-
% accepted parser tokens:
-\def\pgfmathfloatparsenumber@tok@ONE{1}
-\def\pgfmathfloatparsenumber@tok@TWO{2}
-\def\pgfmathfloatparsenumber@tok@THREE{3}
-\def\pgfmathfloatparsenumber@tok@FOUR{4}
-\def\pgfmathfloatparsenumber@tok@FIVE{5}
-\def\pgfmathfloatparsenumber@tok@SIX{6}
-\def\pgfmathfloatparsenumber@tok@SEVEN{7}
-\def\pgfmathfloatparsenumber@tok@EIGHT{8}
-\def\pgfmathfloatparsenumber@tok@NINE{9}
\def\pgfmathfloatparsenumber@tok@ZERO{0}
-\def\pgfmathfloatparsenumber@tok@e{e}
-\def\pgfmathfloatparsenumber@tok@E{E}
\def\pgfmathfloatparsenumber@tok@PLUS{+}
\def\pgfmathfloatparsenumber@tok@MINUS{-}
-\def\pgfmathfloatparsenumber@tok@n{n}
-\def\pgfmathfloatparsenumber@tok@N{N}
-\def\pgfmathfloatparsenumber@tok@i{i}
-\def\pgfmathfloatparsenumber@tok@I{I}
\def\pgfmathfloatparsenumber@tok@PERIOD{.}
\newif\ifpgfmathfloatparsenumberpendingperiod
+\def\pgfflt@EOI{p@EOI}%
+
% Starts a finite-start-machine parser to read a number.
%
+% The machine's state is represented by the macro which is currently
+% processed; state transitions are realised using \csname...#1\endcsname
+% constructions.
+%
% It assigns \pgfmathfloat@a@S, \pgfmathfloat@a@Mtok, \pgfmathfloat@a@E.
-\def\pgfmathfloatparsenumber@impl#1{%
+\def\pgfflt@impl#1{%
\pgfmathfloatparsenumberpendingperiodfalse
\pgfmathfloat@tmptoks={}% this register is used to collect PENDING ZEROS
\pgfmathfloat@a@E=0
% start parsing: check for sign:
- \def\pgfmathfloatparsenumber@curtok{#1}%
- \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@PLUS
- \pgfmathfloat@a@S=1\relax%
- \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@init}%
+ \expandafter\ifx\csname pgfflt@#1\endcsname\relax
+ \pgfmathfloat@a@S=1
+ \expandafter\pgfflt@init\expandafter#1%
\else
- \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@MINUS
- \pgfmathfloat@a@S=2\relax%
- \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@init}%
- \else
- \pgfmathfloat@a@S=1\relax%
- \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@init#1}%
- \fi
+ \expandafter\expandafter\csname pgfflt@#1\endcsname
+ \fi
+}
+% State transitions:
+\expandafter\def\csname pgfflt@+\endcsname{%
+ \pgfmathfloat@a@S=1 %
+ \pgfflt@init}%
+\expandafter\def\csname pgfflt@-\endcsname{%
+ \pgfmathfloat@a@S=2 %
+ \pgfflt@init}%
+\expandafter\def\csname pgfflt@\pgfflt@EOI\endcsname{%
+ \pgfmathfloatparsenumber@handleerror{empty number}{}{}}%
+
+\pgfkeys{
+ /pgf/fpu/handlers/empty number/.style 2 args={%
+ /pgf/fpu/handlers/invalid number={#1}{#2}%
+ },
+ /pgf/fpu/handlers/invalid number/.code 2 args={%
+ \pgfmath@error{Could not parse input '#1' as a floating point number, sorry. The unreadable part was near '#2'.}{}%
+ },
+}
+
+% #1 the error handler
+% #2 the number which was invalid.
+% #3 the part which produced the error
+\def\pgfmathfloatparsenumber@handleerror#1#2#3{%
+ \let\pgfmathresult=\pgfutil@empty
+ \pgfmathfloatparsenumberpendingperiodfalse
+ \pgfkeys{/pgf/fpu/handlers/#1={#2}{#3}}%
+ \ifx\pgfmathresult\pgfutil@empty
+ \pgfmathfloat@a@S=3
+ \pgfmathfloat@a@Mtok={0.0}%
+ \pgfmathfloat@a@E=0
+ \else
+ \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
\fi
- \pgfmathfloatparsenumber@NEXT
}
+\def\pgfflt@error#1\pgfflt@EOI{%
+ \begingroup
+ \pgfmathfloat@a@Mtok={#1}%
+ \xdef\pgfmathfloat@glob@TMP{%
+ \noexpand\pgfmathfloatparsenumber@handleerror
+ {invalid number}{\pgfmathresult}{\the\pgfmathfloat@a@Mtok}}%
+ \endgroup
+ \pgfmathfloat@glob@TMP
+}%
+
-\def\pgfmathfloatparsenumber@sanitize@digit{%
- \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@ONE
- \else
- \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@TWO
- \else
- \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@THREE
- \else
- \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@FOUR
- \else
- \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@FIVE
- \else
- \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@SIX
- \else
- \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@SEVEN
- \else
- \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@EIGHT
- \else
- \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@NINE
- \else
- \def\pgfmathfloatparsenumber@NEXT{\expandafter\pgfmathfloatparsenumber@impl@error\pgfmathfloatparsenumber@curtok}%
- \fi\fi\fi\fi\fi\fi\fi\fi\fi
-}
% FROM: checksign.
%
-\def\pgfmathfloatparsenumber@impl@init#1{%
- \def\pgfmathfloatparsenumber@curtok{#1}%
- \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@n
- \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@readnan}%
+\def\pgfflt@init#1{%
+ \expandafter\ifx\csname pgffltA@#1\endcsname\relax
+ \expandafter\pgfflt@error\expandafter#1%
\else
- \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@i
- \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@readinf}%
- \else
- \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@ZERO
- \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@leadingzero}%
- \else
- \def\pgfmathfloatparsenumber@NEXT{%
- \pgfmathfloat@a@Mtok={#1}%
- \pgfmathfloatparsenumberpendingperiodtrue
- \pgfmathfloatparsenumber@impl@positiveexp}%
- \pgfmathfloatparsenumber@sanitize@digit
- \fi
- \fi
- \fi
- \pgfmathfloatparsenumber@NEXT
-}
-
-\def\pgfmathfloatparsenumber@impl@error#1\pgfmathfloat@EOI{%
- \begingroup
+ \expandafter\expandafter\csname pgffltA@#1\endcsname
+ \fi}
+% state transitions:
+\expandafter\def\csname pgffltA@0\endcsname{\pgfflt@leadingzero}% FIXME: inline optimization!
+\expandafter\def\csname pgffltA@1\endcsname{\pgfflt@nonzerodigit1}%
+\expandafter\def\csname pgffltA@2\endcsname{\pgfflt@nonzerodigit2}%
+\expandafter\def\csname pgffltA@3\endcsname{\pgfflt@nonzerodigit3}%
+\expandafter\def\csname pgffltA@4\endcsname{\pgfflt@nonzerodigit4}%
+\expandafter\def\csname pgffltA@5\endcsname{\pgfflt@nonzerodigit5}%
+\expandafter\def\csname pgffltA@6\endcsname{\pgfflt@nonzerodigit6}%
+\expandafter\def\csname pgffltA@7\endcsname{\pgfflt@nonzerodigit7}%
+\expandafter\def\csname pgffltA@8\endcsname{\pgfflt@nonzerodigit8}%
+\expandafter\def\csname pgffltA@9\endcsname{\pgfflt@nonzerodigit9}%
+\def\pgfflt@nonzerodigit#1{%
\pgfmathfloat@a@Mtok={#1}%
- \pgfmath@error{Could not read input number, sorry. The unreadable part was near '\the\pgfmathfloat@a@Mtok'.}%
- \endgroup
-}%
+ \pgfmathfloatparsenumberpendingperiodtrue
+ \pgfflt@positiveexp}%
+\expandafter\def\csname pgffltA@n\endcsname{\pgfflt@readnan}% FIXME: inlining?
+\expandafter\def\csname pgffltA@N\endcsname{\pgfflt@readNaN}% FIXME: inlining?
+\expandafter\def\csname pgffltA@i\endcsname{\pgfflt@readinf}% FIXME: inlining?
+\expandafter\def\csname pgffltA@I\endcsname{\pgfflt@readINF}% FIXME: inlining?
-\def\pgfmathfloatparsenumber@impl@finish#1\pgfmathfloat@EOI{}
+\def\pgfflt@finish#1\pgfflt@EOI{}
-\def\pgfmathfloatparsenumber@impl@readnan an{%
+\def\pgfflt@readnan an{%
+ \pgfmathfloat@a@S=3\relax%
+ \pgfmathfloat@a@Mtok={0.0}%
+ \pgfmathfloat@a@E=0%
+ \pgfflt@finish
+}
+\def\pgfflt@readNaN aN{%
\pgfmathfloat@a@S=3\relax%
\pgfmathfloat@a@Mtok={0.0}%
\pgfmathfloat@a@E=0%
- \pgfmathfloatparsenumber@impl@finish
+ \pgfflt@finish
}
-\def\pgfmathfloatparsenumber@impl@readinf nf{%
+\def\pgfflt@readinf nf{%
\ifnum\pgfmathfloat@a@S=1
\pgfmathfloat@a@S=4\relax%
\pgfmathfloat@a@Mtok={0.0}%
@@ -2096,227 +1572,228 @@
\pgfmathfloat@a@Mtok={0.0}%
\fi
\pgfmathfloat@a@E=0%
- \pgfmathfloatparsenumber@impl@finish
+ \pgfflt@finish
}
-\def\pgfmathfloatparsenumber@impl@leadingzero#1{%
- \def\pgfmathfloatparsenumber@curtok{#1}%
- \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@ZERO
- \def\pgfmathfloatparsenumber@NEXT{%
- \pgfmathfloatparsenumber@impl@leadingzero}%
+\def\pgfflt@readINF NF{%
+ \ifnum\pgfmathfloat@a@S=1
+ \pgfmathfloat@a@S=4\relax%
+ \pgfmathfloat@a@Mtok={0.0}%
\else
- \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@PERIOD
- \def\pgfmathfloatparsenumber@NEXT{%
- \pgfmathfloat@a@E=-1
- \pgfmathfloatparsenumber@impl@leadingzero@foundperiod}%
- \else
- \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@e
- \def\pgfmathfloatparsenumber@NEXT{%
- \pgfmathfloat@a@S=0\relax%
- \pgfmathfloat@a@Mtok={0.0}%
- \pgfmathfloat@a@E=0%
- \pgfmathfloatparsenumber@impl@readexponent}%
- \else
- \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@E
- \def\pgfmathfloatparsenumber@NEXT{%
- \pgfmathfloat@a@S=0\relax%
- \pgfmathfloat@a@Mtok={0.0}%
- \pgfmathfloat@a@E=0%
- \pgfmathfloatparsenumber@impl@readexponent}%
- \else
- \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloat@EOI
- \def\pgfmathfloatparsenumber@NEXT{%
- \pgfmathfloat@a@S=0\relax%
- \pgfmathfloat@a@Mtok={0.0}%
- \pgfmathfloat@a@E=0%
- }%
- \else
- \def\pgfmathfloatparsenumber@NEXT{%
- \pgfmathfloat@a@Mtok={#1}%
- \pgfmathfloatparsenumberpendingperiodtrue
- \pgfmathfloatparsenumber@impl@positiveexp}%
- \pgfmathfloatparsenumber@sanitize@digit
- \fi\fi\fi
- \fi
+ \pgfmathfloat@a@S=5\relax%
+ \pgfmathfloat@a@Mtok={0.0}%
\fi
- \pgfmathfloatparsenumber@NEXT
+ \pgfmathfloat@a@E=0%
+ \pgfflt@finish
}
+\def\pgfflt@leadingzero#1{%
+ \expandafter\ifx\csname pgffltB@#1\endcsname\relax
+ \expandafter\pgfflt@error\expandafter#1%
+ \else
+ \expandafter\expandafter\csname pgffltB@#1\endcsname
+ \fi}
+% State transitions:
+\expandafter\def\csname pgffltB@0\endcsname{\pgfflt@leadingzero}%
+\expandafter\def\csname pgffltB@1\endcsname{\pgfmathfloat@a@Mtok={1}\pgfmathfloatparsenumberpendingperiodtrue \pgfflt@positiveexp}
+\expandafter\def\csname pgffltB@2\endcsname{\pgfmathfloat@a@Mtok={2}\pgfmathfloatparsenumberpendingperiodtrue \pgfflt@positiveexp}
+\expandafter\def\csname pgffltB@3\endcsname{\pgfmathfloat@a@Mtok={3}\pgfmathfloatparsenumberpendingperiodtrue \pgfflt@positiveexp}
+\expandafter\def\csname pgffltB@4\endcsname{\pgfmathfloat@a@Mtok={4}\pgfmathfloatparsenumberpendingperiodtrue \pgfflt@positiveexp}
+\expandafter\def\csname pgffltB@5\endcsname{\pgfmathfloat@a@Mtok={5}\pgfmathfloatparsenumberpendingperiodtrue \pgfflt@positiveexp}
+\expandafter\def\csname pgffltB@6\endcsname{\pgfmathfloat@a@Mtok={6}\pgfmathfloatparsenumberpendingperiodtrue \pgfflt@positiveexp}
+\expandafter\def\csname pgffltB@7\endcsname{\pgfmathfloat@a@Mtok={7}\pgfmathfloatparsenumberpendingperiodtrue \pgfflt@positiveexp}
+\expandafter\def\csname pgffltB@8\endcsname{\pgfmathfloat@a@Mtok={8}\pgfmathfloatparsenumberpendingperiodtrue \pgfflt@positiveexp}
+\expandafter\def\csname pgffltB@9\endcsname{\pgfmathfloat@a@Mtok={9}\pgfmathfloatparsenumberpendingperiodtrue \pgfflt@positiveexp}
+\expandafter\def\csname pgffltB@\pgfmathfloat@POSTFLAGSCHAR\endcsname{\pgfmathfloat@a@Mtok={0}\pgfflt@readlowlevelfloat}%
+\expandafter\def\csname pgffltB@.\endcsname{%
+ \pgfmathfloat@a@E=-1
+ \pgfflt@leadingzero@foundperiod}%
+\expandafter\def\csname pgffltB@e\endcsname{%
+ \pgfmathfloat@a@S=0\relax%
+ \pgfmathfloat@a@Mtok={0.0}%
+ \pgfmathfloat@a@E=0%
+ \pgfflt@readexponent}%
+\let\pgffltB@E=\pgffltB@e
+\expandafter\def\csname pgffltB@\pgfflt@EOI\endcsname{%
+ \pgfmathfloat@a@S=0\relax%
+ \pgfmathfloat@a@Mtok={0.0}%
+ \pgfmathfloat@a@E=0}%
-\def\pgfmathfloatparsenumber@impl@leadingzero@foundperiod#1{%
- \def\pgfmathfloatparsenumber@curtok{#1}%
- \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@ZERO
- \def\pgfmathfloatparsenumber@NEXT{%
- \advance\pgfmathfloat@a@E by-1
- \pgfmathfloatparsenumber@impl@leadingzero@foundperiod}%
+\def\pgfflt@leadingzero@foundperiod#1{%
+ \expandafter\ifx\csname pgffltC@#1\endcsname\relax
+ \expandafter\pgfflt@error\expandafter#1%
\else
- \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@e
- \def\pgfmathfloatparsenumber@NEXT{%
- \pgfmathfloat@a@S=0\relax%
- \pgfmathfloat@a@Mtok={0.0}%
- \pgfmathfloat@a@E=0%
- \pgfmathfloatparsenumber@impl@readexponent}%
- \else
- \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@E
- \def\pgfmathfloatparsenumber@NEXT{%
- \pgfmathfloat@a@S=0\relax%
- \pgfmathfloat@a@Mtok={0.0}%
- \pgfmathfloat@a@E=0%
- \pgfmathfloatparsenumber@impl@readexponent}%
- \else
- \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloat@EOI
- \def\pgfmathfloatparsenumber@NEXT{%
- \pgfmathfloat@a@S=0\relax%
- \pgfmathfloat@a@Mtok={0.0}%
- \pgfmathfloat@a@E=0%
- }%
- \else
- \def\pgfmathfloatparsenumber@NEXT{%
- \pgfmathfloat@a@Mtok={#1}%
- \pgfmathfloatparsenumberpendingperiodtrue
- \pgfmathfloatparsenumber@impl@finish@number@after@period}%
- \pgfmathfloatparsenumber@sanitize@digit
- \fi\fi\fi
- \fi
- \pgfmathfloatparsenumber@NEXT
-}
+ \expandafter\expandafter\csname pgffltC@#1\endcsname
+ \fi}
+% State transitions:
+\expandafter\def\csname pgffltC@0\endcsname{%
+ \advance\pgfmathfloat@a@E by-1
+ \pgfflt@leadingzero@foundperiod}%
+\expandafter\def\csname pgffltC@1\endcsname{\pgfmathfloat@a@Mtok={1}\pgfmathfloatparsenumberpendingperiodtrue\pgfflt@finish@number@after@period}%
+\expandafter\def\csname pgffltC@2\endcsname{\pgfmathfloat@a@Mtok={2}\pgfmathfloatparsenumberpendingperiodtrue\pgfflt@finish@number@after@period}%
+\expandafter\def\csname pgffltC@3\endcsname{\pgfmathfloat@a@Mtok={3}\pgfmathfloatparsenumberpendingperiodtrue\pgfflt@finish@number@after@period}%
+\expandafter\def\csname pgffltC@4\endcsname{\pgfmathfloat@a@Mtok={4}\pgfmathfloatparsenumberpendingperiodtrue\pgfflt@finish@number@after@period}%
+\expandafter\def\csname pgffltC@5\endcsname{\pgfmathfloat@a@Mtok={5}\pgfmathfloatparsenumberpendingperiodtrue\pgfflt@finish@number@after@period}%
+\expandafter\def\csname pgffltC@6\endcsname{\pgfmathfloat@a@Mtok={6}\pgfmathfloatparsenumberpendingperiodtrue\pgfflt@finish@number@after@period}%
+\expandafter\def\csname pgffltC@7\endcsname{\pgfmathfloat@a@Mtok={7}\pgfmathfloatparsenumberpendingperiodtrue\pgfflt@finish@number@after@period}%
+\expandafter\def\csname pgffltC@8\endcsname{\pgfmathfloat@a@Mtok={8}\pgfmathfloatparsenumberpendingperiodtrue\pgfflt@finish@number@after@period}%
+\expandafter\def\csname pgffltC@9\endcsname{\pgfmathfloat@a@Mtok={9}\pgfmathfloatparsenumberpendingperiodtrue\pgfflt@finish@number@after@period}%
+\expandafter\def\csname pgffltC@e\endcsname{%
+ \pgfmathfloat@a@S=0\relax%
+ \pgfmathfloat@a@Mtok={0.0}%
+ \pgfmathfloat@a@E=0%
+ \pgfflt@readexponent}%
+\let\pgffltC@E=\pgffltC@e
+\expandafter\def\csname pgffltC@\pgfflt@EOI\endcsname{%
+ \pgfmathfloat@a@S=0\relax%
+ \pgfmathfloat@a@Mtok={0.0}%
+ \pgfmathfloat@a@E=0}%
-\def\pgfmathfloatparsenumber@impl@positiveexp#1{%
- \def\pgfmathfloatparsenumber@curtok{#1}%
- \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@ZERO
- \def\pgfmathfloatparsenumber@NEXT{%
- \advance\pgfmathfloat@a@E by1
- \pgfmathfloat@tmptoks=\expandafter{\the\pgfmathfloat@tmptoks0}%
- \pgfmathfloatparsenumber@impl@pendingzeros@positiveexp}%
+\def\pgfflt@positiveexp#1{%
+ \expandafter\ifx\csname pgffltD@#1\endcsname\relax
+ \expandafter\pgfflt@error\expandafter#1%
\else
- \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@PERIOD
- \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@finish@number@after@period}%
- \else
- \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@e
- \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@readexponent}%
- \else
- \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@E
- \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@readexponent}%
- \else
- \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloat@EOI
- \def\pgfmathfloatparsenumber@NEXT{}%
- \else
- \def\pgfmathfloatparsenumber@NEXT{%
- \advance\pgfmathfloat@a@E by1
- \ifpgfmathfloatparsenumberpendingperiod
- \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.}%
- \pgfmathfloatparsenumberpendingperiodfalse
- \fi
- \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok#1}%
- \pgfmathfloatparsenumber@impl@positiveexp}%
- \pgfmathfloatparsenumber@sanitize@digit
- \fi\fi\fi
- \fi
+ \expandafter\expandafter\csname pgffltD@#1\endcsname
+ \fi}
+% State transitions:
+\expandafter\def\csname pgffltD@0\endcsname{%
+ \advance\pgfmathfloat@a@E by1
+ \pgfmathfloat@tmptoks=\expandafter{\the\pgfmathfloat@tmptoks0}%
+ \pgfflt@pendingzeros@positiveexp}%
+\expandafter\def\csname pgffltD@1\endcsname{\pgffltD@nonzerodigit1}%
+\expandafter\def\csname pgffltD@2\endcsname{\pgffltD@nonzerodigit2}%
+\expandafter\def\csname pgffltD@3\endcsname{\pgffltD@nonzerodigit3}%
+\expandafter\def\csname pgffltD@4\endcsname{\pgffltD@nonzerodigit4}%
+\expandafter\def\csname pgffltD@5\endcsname{\pgffltD@nonzerodigit5}%
+\expandafter\def\csname pgffltD@6\endcsname{\pgffltD@nonzerodigit6}%
+\expandafter\def\csname pgffltD@7\endcsname{\pgffltD@nonzerodigit7}%
+\expandafter\def\csname pgffltD@8\endcsname{\pgffltD@nonzerodigit8}%
+\expandafter\def\csname pgffltD@9\endcsname{\pgffltD@nonzerodigit9}%
+\expandafter\def\csname pgffltD@\pgfmathfloat@POSTFLAGSCHAR\endcsname{\pgfflt@readlowlevelfloat}%
+\expandafter\def\csname pgffltD@.\endcsname{\pgfflt@finish@number@after@period}% FIXME : inlining?
+\expandafter\def\csname pgffltD@e\endcsname{\pgfflt@readexponent}% FIXME : inlining?
+\let\pgffltD@E=\pgffltD@e
+\expandafter\def\csname pgffltD@\pgfflt@EOI\endcsname{}% NOP
+\def\pgffltD@nonzerodigit#1{%
+ \advance\pgfmathfloat@a@E by1
+ \ifpgfmathfloatparsenumberpendingperiod
+ \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.}%
+ \pgfmathfloatparsenumberpendingperiodfalse
\fi
- \pgfmathfloatparsenumber@NEXT
-}
+ \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok#1}%
+ \pgfflt@positiveexp}%
-\def\pgfmathfloatparsenumber@impl@readexponent#1\pgfmathfloat@EOI{%
+% Read a low-level floating point.
+% Since we are in the second state, \pgfmathfloat@a@Mtok contains the
+% FLAGS. The post-flags-char has also been read.
+\def\pgfflt@readlowlevelfloat#1e#2]\pgfflt@EOI{%
+ \pgfmathfloatparsenumberpendingperiodfalse
+ \pgfmathfloat@a@S=\the\pgfmathfloat@a@Mtok\relax
+ \pgfmathfloat@a@Mtok={#1}%
+ \pgfmathfloat@a@E=#2
+}%
+
+\def\pgfflt@readexponent#1\pgfflt@EOI{%
\advance\pgfmathfloat@a@E by#1\relax
}
-\def\pgfmathfloatparsenumber@impl@pendingzeros@positiveexp#1{%
- \def\pgfmathfloatparsenumber@curtok{#1}%
- \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@ZERO
- \def\pgfmathfloatparsenumber@NEXT{%
- \pgfmathfloat@tmptoks=\expandafter{\the\pgfmathfloat@tmptoks0}%
- \advance\pgfmathfloat@a@E by1
- \pgfmathfloatparsenumber@impl@pendingzeros@positiveexp}%
+\def\pgfflt@pendingzeros@positiveexp#1{%
+ \expandafter\ifx\csname pgffltE@#1\endcsname\relax
+ \expandafter\pgfflt@error\expandafter#1%
\else
- \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@PERIOD
- \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@finish@number@after@period}%
- \else
- \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@e
- \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@readexponent}%
- \else
- \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@E
- \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@readexponent}%
- \else
- \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloat@EOI
- \def\pgfmathfloatparsenumber@NEXT{}%
- \else
- \def\pgfmathfloatparsenumber@NEXT{%
- \advance\pgfmathfloat@a@E by1
- \ifpgfmathfloatparsenumberpendingperiod
- \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.}%
- \pgfmathfloatparsenumberpendingperiodfalse
- \fi
- \pgfmathfloat@a@Mtok=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\pgfmathfloat@a@Mtok\the\pgfmathfloat@tmptoks}%
- \pgfmathfloat@tmptoks={}%
- \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok#1}%
- \pgfmathfloatparsenumber@impl@positiveexp}%
- \pgfmathfloatparsenumber@sanitize@digit
- \fi\fi\fi
- \fi
+ \expandafter\expandafter\csname pgffltE@#1\endcsname
+ \fi}
+% State transitions:
+\expandafter\def\csname pgffltE@0\endcsname{%
+ \pgfmathfloat@tmptoks=\expandafter{\the\pgfmathfloat@tmptoks0}%
+ \advance\pgfmathfloat@a@E by1
+ \pgfflt@pendingzeros@positiveexp}%
+\expandafter\def\csname pgffltE@1\endcsname{\pgffltE@nonzerodigit1}%
+\expandafter\def\csname pgffltE@2\endcsname{\pgffltE@nonzerodigit2}%
+\expandafter\def\csname pgffltE@3\endcsname{\pgffltE@nonzerodigit3}%
+\expandafter\def\csname pgffltE@4\endcsname{\pgffltE@nonzerodigit4}%
+\expandafter\def\csname pgffltE@5\endcsname{\pgffltE@nonzerodigit5}%
+\expandafter\def\csname pgffltE@6\endcsname{\pgffltE@nonzerodigit6}%
+\expandafter\def\csname pgffltE@7\endcsname{\pgffltE@nonzerodigit7}%
+\expandafter\def\csname pgffltE@8\endcsname{\pgffltE@nonzerodigit8}%
+\expandafter\def\csname pgffltE@9\endcsname{\pgffltE@nonzerodigit9}%
+\expandafter\def\csname pgffltE@.\endcsname{\pgfflt@finish@number@after@period}% FIXME : inlining?
+\def\pgffltE@e{\pgfflt@readexponent}% FIXME : inlining?
+\let\pgffltE@E=\pgffltE@e
+\expandafter\def\csname pgffltE@\pgfflt@EOI\endcsname{}% NOP
+\def\pgffltE@nonzerodigit#1{%
+ \advance\pgfmathfloat@a@E by1
+ \ifpgfmathfloatparsenumberpendingperiod
+ \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.}%
+ \pgfmathfloatparsenumberpendingperiodfalse
\fi
- \pgfmathfloatparsenumber@NEXT
-}
+ \pgfmathfloat@a@Mtok=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\pgfmathfloat@a@Mtok\the\pgfmathfloat@tmptoks}%
+ \pgfmathfloat@tmptoks={}%
+ \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok#1}%
+ \pgfflt@positiveexp}%
-\def\pgfmathfloatparsenumber@impl@finish@number@after@period#1{%
- \def\pgfmathfloatparsenumber@curtok{#1}%
- \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@ZERO
- \def\pgfmathfloatparsenumber@NEXT{%
- \pgfmathfloat@tmptoks=\expandafter{\the\pgfmathfloat@tmptoks0}%
- \pgfmathfloatparsenumber@impl@pendingzeros}%
+\def\pgfflt@finish@number@after@period#1{%
+ \expandafter\ifx\csname pgffltF@#1\endcsname\relax
+ \expandafter\pgfflt@error\expandafter#1%
\else
- \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@e
- \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@readexponent}%
- \else
- \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@E
- \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@readexponent}%
- \else
- \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloat@EOI
- \def\pgfmathfloatparsenumber@NEXT{}%
- \else
- \def\pgfmathfloatparsenumber@NEXT{%
- \ifpgfmathfloatparsenumberpendingperiod
- \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.}%
- \pgfmathfloatparsenumberpendingperiodfalse
- \fi
- \pgfmathfloat@a@Mtok=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\pgfmathfloat@a@Mtok\the\pgfmathfloat@tmptoks}%
- \pgfmathfloat@tmptoks={}%
- \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok#1}%
- \pgfmathfloatparsenumber@impl@finish@number@after@period}%
- \pgfmathfloatparsenumber@sanitize@digit
- \fi\fi\fi
+ \expandafter\expandafter\csname pgffltF@#1\endcsname
+ \fi}
+% State transitions:
+\expandafter\def\csname pgffltF@0\endcsname{%
+ \pgfmathfloat@tmptoks=\expandafter{\the\pgfmathfloat@tmptoks0}%
+ \pgfflt@pendingzeros}%
+\expandafter\def\csname pgffltF@1\endcsname{\pgffltF@nonzerodigit1}%
+\expandafter\def\csname pgffltF@2\endcsname{\pgffltF@nonzerodigit2}%
+\expandafter\def\csname pgffltF@3\endcsname{\pgffltF@nonzerodigit3}%
+\expandafter\def\csname pgffltF@4\endcsname{\pgffltF@nonzerodigit4}%
+\expandafter\def\csname pgffltF@5\endcsname{\pgffltF@nonzerodigit5}%
+\expandafter\def\csname pgffltF@6\endcsname{\pgffltF@nonzerodigit6}%
+\expandafter\def\csname pgffltF@7\endcsname{\pgffltF@nonzerodigit7}%
+\expandafter\def\csname pgffltF@8\endcsname{\pgffltF@nonzerodigit8}%
+\expandafter\def\csname pgffltF@9\endcsname{\pgffltF@nonzerodigit9}%
+\def\pgffltF@e{\pgfflt@readexponent}%
+\let\pgffltF@E=\pgffltF@e
+\expandafter\def\csname pgffltF@\pgfflt@EOI\endcsname{}% NOP
+\def\pgffltF@nonzerodigit#1{%
+ \ifpgfmathfloatparsenumberpendingperiod
+ \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.}%
+ \pgfmathfloatparsenumberpendingperiodfalse
\fi
- \pgfmathfloatparsenumber@NEXT
-}
+ \pgfmathfloat@a@Mtok=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\pgfmathfloat@a@Mtok\the\pgfmathfloat@tmptoks}%
+ \pgfmathfloat@tmptoks={}%
+ \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok#1}%
+ \pgfflt@finish@number@after@period}%
-\def\pgfmathfloatparsenumber@impl@pendingzeros#1{%
- \def\pgfmathfloatparsenumber@curtok{#1}%
- \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@ZERO
- \def\pgfmathfloatparsenumber@NEXT{%
- \pgfmathfloat@tmptoks=\expandafter{\the\pgfmathfloat@tmptoks0}%
- \pgfmathfloatparsenumber@impl@pendingzeros}%
+
+\def\pgfflt@pendingzeros#1{%
+ \expandafter\ifx\csname pgffltG@#1\endcsname\relax
+ \expandafter\pgfflt@error\expandafter#1%
\else
- \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@e
- \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@readexponent}%
- \else
- \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@E
- \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@readexponent}%
- \else
- \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloat@EOI
- \def\pgfmathfloatparsenumber@NEXT{}%
- \else
- \def\pgfmathfloatparsenumber@NEXT{%
- \ifpgfmathfloatparsenumberpendingperiod
- \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.}%
- \pgfmathfloatparsenumberpendingperiodfalse
- \fi
- \pgfmathfloat@a@Mtok=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\pgfmathfloat@a@Mtok\the\pgfmathfloat@tmptoks}%
- \pgfmathfloat@tmptoks={}%
- \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok#1}%
- \pgfmathfloatparsenumber@impl@finish@number@after@period}%
- \pgfmathfloatparsenumber@sanitize@digit
- \fi\fi\fi
+ \expandafter\expandafter\csname pgffltG@#1\endcsname
+ \fi}
+% State transitions:
+\expandafter\def\csname pgffltG@0\endcsname{%
+ \pgfmathfloat@tmptoks=\expandafter{\the\pgfmathfloat@tmptoks0}%
+ \pgfflt@pendingzeros}%
+\expandafter\def\csname pgffltG@1\endcsname{\pgffltG@nonzerodigit1}%
+\expandafter\def\csname pgffltG@2\endcsname{\pgffltG@nonzerodigit2}%
+\expandafter\def\csname pgffltG@3\endcsname{\pgffltG@nonzerodigit3}%
+\expandafter\def\csname pgffltG@4\endcsname{\pgffltG@nonzerodigit4}%
+\expandafter\def\csname pgffltG@5\endcsname{\pgffltG@nonzerodigit5}%
+\expandafter\def\csname pgffltG@6\endcsname{\pgffltG@nonzerodigit6}%
+\expandafter\def\csname pgffltG@7\endcsname{\pgffltG@nonzerodigit7}%
+\expandafter\def\csname pgffltG@8\endcsname{\pgffltG@nonzerodigit8}%
+\expandafter\def\csname pgffltG@9\endcsname{\pgffltG@nonzerodigit9}%
+\def\pgffltG@e{\pgfflt@readexponent}% FIXME: inlining?
+\let\pgffltG@E=\pgffltG@e
+\expandafter\def\csname pgffltG@\pgfflt@EOI\endcsname{}% NOP
+\def\pgffltG@nonzerodigit#1{%
+ \ifpgfmathfloatparsenumberpendingperiod
+ \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.}%
+ \pgfmathfloatparsenumberpendingperiodfalse
\fi
- \pgfmathfloatparsenumber@NEXT
-}
-
-
+ \pgfmathfloat@a@Mtok=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\pgfmathfloat@a@Mtok\the\pgfmathfloat@tmptoks}%
+ \pgfmathfloat@tmptoks={}%
+ \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok#1}%
+ \pgfflt@finish@number@after@period}%
+\endinput