summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pgf/math
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-05-12 20:23:02 +0000
committerKarl Berry <karl@freefriends.org>2019-05-12 20:23:02 +0000
commit22cbaf8cd711b82b3fe4b387a7e72b58409ecdbd (patch)
tree0b785b59273566c030b567add8671b7f06167054 /Master/texmf-dist/tex/generic/pgf/math
parent692a797099b0acfd35d4bbd6a322acdc87c2c3a8 (diff)
pgf
git-svn-id: svn://tug.org/texlive/trunk@51107 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgf/math')
-rw-r--r--Master/texmf-dist/tex/generic/pgf/math/pgfint.code.tex126
-rw-r--r--Master/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex2
-rw-r--r--Master/texmf-dist/tex/generic/pgf/math/pgfmathcalc.code.tex24
-rw-r--r--Master/texmf-dist/tex/generic/pgf/math/pgfmathfloat.code.tex3445
-rw-r--r--Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.base.code.tex353
-rw-r--r--Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.basic.code.tex1086
-rw-r--r--Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.code.tex329
-rw-r--r--Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.comparison.code.tex110
-rw-r--r--Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.integerarithmetics.code.tex30
-rw-r--r--Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.misc.code.tex446
-rw-r--r--Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.random.code.tex260
-rw-r--r--Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.round.code.tex156
-rw-r--r--Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.trigonometric.code.tex124
-rw-r--r--Master/texmf-dist/tex/generic/pgf/math/pgfmathode.code.tex20
-rw-r--r--Master/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex144
-rw-r--r--Master/texmf-dist/tex/generic/pgf/math/pgfmathutil.code.tex172
16 files changed, 3479 insertions, 3348 deletions
diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfint.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfint.code.tex
new file mode 100644
index 00000000000..8921ee5fbd1
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/math/pgfint.code.tex
@@ -0,0 +1,126 @@
+% Copyright 2019 by Henri Menke
+%
+% This file may be distributed and/or modified
+%
+% 1. under the LaTeX Project Public License and/or
+% 2. under the GNU Public License.
+%
+% See the file doc/generic/pgf/licenses/LICENSE for more details.
+
+
+% Guard against reading twice
+\ifx\pgfintloaded\pgfutil@undefined
+ \let\pgfintloaded=\relax
+\else
+ \expandafter\endinput
+\fi
+
+% This module is pretty much a rip-off of the LaTeX3 l3int module for integer
+% calculations. Since PGF supports e-TeX now, we can make use of those
+% extended facilities.
+
+% In contrast to l3int we will just admit that integers are regular TeX \count
+% register and will not implement an extra "integer datatype".
+
+% Evaluate an integer expression using \numexpr
+\def\pgfinteval#1{\number\numexpr#1\relax}
+
+% Get the absolute value of an integer by stripping off a leading minus sign
+\def\pgfintabs#1{\number\expandafter\pgfint@abs\number\numexpr#1\relax}
+\def\pgfint@abs#1{\ifx-#1\else\expandafter#1\fi}
+
+% Minimum and maximum
+\def\pgfintmax#1#2{%
+ \number\expandafter\pgfint@minmax
+ \number\numexpr#1\expandafter;%
+ \number\numexpr#2;%
+ >
+}
+\def\pgfintmin#1#2{%
+ \number\expandafter\pgfint@minmax
+ \number\numexpr#1\expandafter;%
+ \number\numexpr#2;%
+ <
+}
+\def\pgfint@minmax#1;#2;#3{%
+ \ifnum#1#3#2
+ #1%
+ \else
+ #2%
+ \fi
+}
+
+% \numexpr has the annoying property to round divisions rather than truncating
+% (as you would expect for integer arithmetic). Therefore we need a truncating
+% division function.
+\def\pgfintdivtruncate#1#2{%
+ \number\numexpr\expandafter\pgfint@divtruncate
+ \number\numexpr#1\expandafter;%
+ \number\numexpr#2;%
+ \relax
+}
+\def\pgfint@divtruncate#1#2;#3#4;{%
+ \ifx0#1
+ 0%
+ \else
+ (#1#2%
+ \ifx-#1 +\else-\fi
+ (\ifx-#3 -\fi#3#4-1)/2%
+ )%
+ \fi
+ /#3#4%
+}
+
+% \pgfintdivtruncate always truncates the result which leads to a rounding
+% towards zero. Donald Knuth defines in TAoCP, Vol 1, 3rd Ed, Section 1.2.4
+% that the modulo operation is
+%
+% x mod y = x - y * floor(x/y)
+%
+% In contrast to truncated division, floored division always rounds towards
+% -inf, i.e. floor(1/2) = 0 and floor(-1/2) = -1. This is also how integer
+% division is done in Lua.
+\def\pgfintdivfloor#1#2{%
+ \number\numexpr\expandafter\pgfint@divfloor
+ \number\numexpr#1\expandafter;%
+ \number\numexpr#2;%
+ \relax
+}
+\def\pgfint@divfloor#1#2;#3#4;{%
+ \ifx0#1
+ 0%
+ \else
+ \ifnum
+ 0\ifx-#1\ifx#3-\else1\fi\fi
+ 0\ifx-#3\ifx#1-\else1\fi\fi
+ >0
+ \pgfint@@divfloor#1#2;#3#4;-+%
+ \else
+ \pgfint@@divfloor#1#2;#3#4;+-%
+ \fi
+ \fi
+ /#3#4%
+}
+\def\pgfint@@divfloor#1#2;#3#4;#5#6{%
+ (#1#2%
+ \ifx-#1 #5\else#6\fi
+ (\ifx-#3 -\fi#3#4#61)/2%
+ )%
+}
+
+% Round
+\def\pgfintdivround#1#2{\number\numexpr(#1)/(#2)\relax}
+
+% Modulo
+\def\pgfintmod#1#2{%
+ \number\numexpr\expandafter\pgfint@mod%
+ \number\numexpr#1\expandafter;%
+ \number\numexpr#2;%
+ \relax
+}
+\def\pgfint@mod#1;#2;{#1-(\pgfint@divfloor#1;#2;)*#2}
+
+% Setter function so we don't always have to write \pgfinteval
+\def\pgfintset#1#2{#1 \numexpr#2\relax}
+
+\endinput
diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex
index fd3eea1b0bf..fb629421d54 100644
--- a/Master/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex
@@ -23,4 +23,4 @@
\input pgfmathcalc.code.tex
\input pgfmathfloat.code.tex
-\endinput \ No newline at end of file
+\endinput
diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmathcalc.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmathcalc.code.tex
index 5cc58e62e5d..58c51558c8a 100644
--- a/Master/texmf-dist/tex/generic/pgf/math/pgfmathcalc.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/math/pgfmathcalc.code.tex
@@ -40,7 +40,7 @@
\pgfmath@selectfont%
#1#2\unskip%
\expandafter\endgroup%
- \expandafter#1\the#1\relax%
+ \expandafter#1\the#1\relax%
}%
{%
\pgfmathparse{#2}%
@@ -68,7 +68,7 @@
\advance#1#2\unskip%
\expandafter%
\endgroup%
- \expandafter#1\the#1\relax%
+ \expandafter#1\the#1\relax%
}%
{%
\pgfmathparse{#2}%
@@ -202,7 +202,7 @@
\def\pgfmathsetmacro#1#2{%
\begingroup%
\pgfmathparse{#2}%
- \let#1=\pgfmathresult
+ \let#1=\pgfmathresult
\pgfmath@smuggleone{#1}%
\endgroup%
}
@@ -264,7 +264,7 @@
% *** The following commands DO NOT WORK without the rest of PGF ***
%
% (a dumping ground for stuff that doesn't really belong anywhere else)
-
+
% \pgfmathanglebetweenpoints
%
% Define \pgfmathresult as the angle between points #1 and #2
@@ -354,7 +354,7 @@
-% \pgfmathpointintersectionoflineandarc
+% \pgfmathpointintersectionoflineandarc
%
% A bit experimental at the moment:
%
@@ -385,10 +385,10 @@
\pgf@polar@#6 and #6\@@%
\fi%
\edef\xarcradius{\the\pgf@x}%
- \edef\yarcradius{\the\pgf@y}%
+ \edef\yarcradius{\the\pgf@y}%
%
% Get the start and end angles of the arc...
- %
+ %
\pgfmathsetmacro\s{#4}%
\pgfmathsetmacro\e{#5}%
%
@@ -420,7 +420,7 @@
\pgfmathadd@{\s}{\e}%
\pgfmathdivide@{\pgfmathresult}{2}%
\let\p\pgfmathresult%
- \ifdim\p pt=\s pt\relax%
+ \ifdim\p pt=\s pt\relax%
\else%
\pgfmathanglebetweenpoints{#2}{%
\pgfpointadd{#3}{%
@@ -466,14 +466,14 @@
\ifdim\pgfmathresult pt<\m pt\relax%
\let\m\pgfmathresult%
\let\n\p%
- \fi%
+ \fi%
\repeatpgfmathloop%
\pgfpointadd{#3}{\pgfpointpolar{\n}{\xarcradius and \yarcradius}}%
}%
}
% \pgfmathangleonellipse
-%
+%
% Find the angle corresponding to a point on the border of an ellispe.
%
% #1 - the point on the border.
@@ -489,7 +489,7 @@
\fi%
\pgf@xa\pgf@x%
\pgf@ya\pgf@y%
- \pgf@process{#1}%
+ \pgf@process{#1}%
\ifdim\pgf@x=0pt\relax%
\pgfutil@tempdima1pt\relax%
\else%
@@ -530,7 +530,7 @@
\ifdim\pgf@y=0pt\relax%
\pgfutil@tempdima0pt\relax%
\fi%
- \fi%
+ \fi%
\fi%
\pgfmath@returnone\pgfutil@tempdima%
\endgroup%
diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmathfloat.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfloat.code.tex
index 006d6ea4046..bda29cb51b7 100644
--- a/Master/texmf-dist/tex/generic/pgf/math/pgfmathfloat.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfloat.code.tex
@@ -13,23 +13,23 @@
\pgfkeys{
- % The bug 3430171 (wrong minus sign spacing in pgfmathprintnumber)
- % has been fixed in 2.10 CVS. Since it changes the spacing, its
- % effects can be undone with this compatibility switch.
- /pgf/compat/number printer/.is choice,
- /pgf/compat/number printer/2.10/.code={%
- \def\pgfmathprintnumber@begingroup{\bgroup}%
- \def\pgfmathprintnumber@endgroup{\egroup}%
- },
- % I do not know the version number of the next release at this
- % time. Please be so kind and KEEP THIS NAME INTACT. Add an alias
- % if needed.
- /pgf/compat/number printer/next after 2.10/.code={%
- \def\pgfmathprintnumber@begingroup{\begingroup}%
- \def\pgfmathprintnumber@endgroup{\endgroup}%
- },
- % activate the fix by default.
- /pgf/compat/number printer/next after 2.10,%
+ % The bug 3430171 (wrong minus sign spacing in pgfmathprintnumber)
+ % has been fixed in 2.10 CVS. Since it changes the spacing, its
+ % effects can be undone with this compatibility switch.
+ /pgf/compat/number printer/.is choice,
+ /pgf/compat/number printer/2.10/.code={%
+ \def\pgfmathprintnumber@begingroup{\bgroup}%
+ \def\pgfmathprintnumber@endgroup{\egroup}%
+ },
+ % I do not know the version number of the next release at this
+ % time. Please be so kind and KEEP THIS NAME INTACT. Add an alias
+ % if needed.
+ /pgf/compat/number printer/next after 2.10/.code={%
+ \def\pgfmathprintnumber@begingroup{\begingroup}%
+ \def\pgfmathprintnumber@endgroup{\endgroup}%
+ },
+ % activate the fix by default.
+ /pgf/compat/number printer/next after 2.10,%
}
@@ -55,7 +55,7 @@
% can be changed with options.
\def\pgfmathfloat@round@precision{2}
-% I introduced this to acces the "original" precision in case a
+% I introduced this to access the "original" precision in case a
% formatted changes it locally... in this case, the formatter may
% overwrite \pgfmathfloat@round@precision@orig to provide the original
% one.
@@ -70,7 +70,7 @@
% [FLAGS] MANTISSE EXPONENT
% meaning
% [+-]X.XXXXXXX*10^C
-% where
+% where
% X.XXXXXX is a mantissa with first number != 0, C is an integer and
% FLAGS contains the sign and some other special cases.
%
@@ -78,7 +78,7 @@
% 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.
+% errors in these cases.
%
% It is to be used to compute logs, because log(X*10^Y) = log(X) + log(10)*Y
%
@@ -98,12 +98,12 @@
% FLAGS MANTISSE 'e' EXPONENT
% where
% FLAGS is a number in [0-5] where
-% 0 == '0' (the number is +- 0.0),
-% 1 == '+',
-% 2 == '-',
-% 3 == 'not a number'
-% 4 == '+ infinity'
-% 5 == '- infinity'
+% 0 == '0' (the number is +- 0.0),
+% 1 == '+',
+% 2 == '-',
+% 3 == 'not a number'
+% 4 == '+ infinity'
+% 5 == '- infinity'
%
% MANTISSE is a normalised number 1 <= M < 10. It always contains a
% period and at least one digit after the period.
@@ -116,15 +116,15 @@
% \pgfmathfloatparsenumber{141.212}
% -> \pgfmathresult = 11.41212e2
\def\pgfmathfloatparsenumber#1{%
- \begingroup
- \edef\pgfmathresult{#1}%
- \expandafter\pgfflt@impl\pgfmathresult\pgfflt@EOI
- \ifpgfmathfloatparsenumberpendingperiod
- \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.0}%
- \fi
- \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}%
- \pgfmath@smuggleone\pgfmathresult
- \endgroup
+ \begingroup
+ \edef\pgfmathresult{#1}%
+ \expandafter\pgfflt@impl\pgfmathresult\pgfflt@EOI
+ \ifpgfmathfloatparsenumberpendingperiod
+ \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.0}%
+ \fi
+ \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}%
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
}
% The same as \pgfmathfloatparsenumber, but does not perform sanity checking.
@@ -135,36 +135,36 @@
% register #2, mantissa to dimen register #3 and exponent to count
% register #4.
\def\pgfmathfloattoregisters#1#2#3#4{%
- \expandafter\pgfmathfloat@decompose#1\relax{#2}{#3}{#4}%
+ \expandafter\pgfmathfloat@decompose#1\relax{#2}{#3}{#4}%
}
% the same, but writes the mantissa into a token register.
\def\pgfmathfloattoregisterstok#1#2#3#4{%
- \expandafter\pgfmathfloat@decompose@tok#1\relax{#2}{#3}{#4}%
+ \expandafter\pgfmathfloat@decompose@tok#1\relax{#2}{#3}{#4}%
}
% Extracts the flags of #1 into the count register #2.
\def\pgfmathfloatgetflags#1#2{%
- \expandafter\pgfmathfloat@decompose@F#1\relax{#2}%
+ \expandafter\pgfmathfloat@decompose@F#1\relax{#2}%
}
% Extracts the flags of #1 into the macro #2.
\def\pgfmathfloatgetflagstomacro#1#2{%
- \expandafter\pgfmathfloat@decompose@Fmacro#1\relax{#2}%
+ \expandafter\pgfmathfloat@decompose@Fmacro#1\relax{#2}%
}%
% Extracts the mantissa of #1 into the dimen register #2.
\def\pgfmathfloatgetmantissa#1#2{%
- \expandafter\pgfmathfloat@decompose@M#1\relax{#2}%
+ \expandafter\pgfmathfloat@decompose@M#1\relax{#2}%
}
\let\pgfmathfloatgetmantisse=\pgfmathfloatgetmantissa
% Extracts the mantissa of #1 into the token register #2.
\def\pgfmathfloatgetmantissatok#1#2{%
- \expandafter\pgfmathfloat@decompose@Mtok#1\relax{#2}%
+ \expandafter\pgfmathfloat@decompose@Mtok#1\relax{#2}%
}
\let\pgfmathfloatgetmantissetok=\pgfmathfloatgetmantissatok
% Extracts the exponent of #1 into the count register #2.
\def\pgfmathfloatgetexponent#1#2{%
- \expandafter\pgfmathfloat@decompose@E#1\relax{#2}%
+ \expandafter\pgfmathfloat@decompose@E#1\relax{#2}%
}
@@ -179,22 +179,22 @@
% format.
\def\pgfmathfloat@to@FMeE@style#1{\expandafter\pgfmathfloat@to@FMeE@style@#1\relax\relax}%
\def\pgfmathfloat@to@FMeE@style@#1#2{%
- \ifx#2Y%
- \expandafter\pgfmathfloat@to@FMeE@style@@%
- \else
- \expandafter\pgfmathfloat@to@FMeE@style@error%
- \fi
- #1#2%
+ \ifx#2Y%
+ \expandafter\pgfmathfloat@to@FMeE@style@@%
+ \else
+ \expandafter\pgfmathfloat@to@FMeE@style@error%
+ \fi
+ #1#2%
}%
\def\pgfmathfloat@to@FMeE@style@@#1Y#2e#3]\relax\relax{\def\pgfmathresult{#1#2e#3}}%
\def\pgfmathfloat@to@FMeE@style@error#1\relax\relax{%
- \begingroup
- \pgfmathfloatparsenumber@handleerror{wrong lowlevel format}{#1}{#1}%
- \xdef\pgfmathfloat@decompose@TMP{%
- \noexpand\pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}%
- }%
- \endgroup
- \pgfmathfloat@decompose@TMP
+ \begingroup
+ \pgfmathfloatparsenumber@handleerror{wrong lowlevel format}{#1}{#1}%
+ \xdef\pgfmathfloat@decompose@TMP{%
+ \noexpand\pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}%
+ }%
+ \endgroup
+ \pgfmathfloat@decompose@TMP
}%
@@ -208,12 +208,12 @@
% \expandafter\pgfmathfloat@decompose\pgfmathresult\relax\pgfmathfloat@a@S\pgfmathfloat@a@M\pgfmathfloat@a@E
% -> the three temp registers contain flags, mantissa and exponent
\def\pgfmathfloat@decompose#1#2{% sanitize!
- \ifx#2Y%
- \expandafter\pgfmathfloat@decompose@%
- \else
- \expandafter\pgfmathfloat@decompose@error%
- \fi
- #1#2%
+ \ifx#2Y%
+ \expandafter\pgfmathfloat@decompose@%
+ \else
+ \expandafter\pgfmathfloat@decompose@error%
+ \fi
+ #1#2%
}
\def\pgfmathfloat@decompose@#1Y#2e#3]\relax#4#5#6{%
#4=#1\relax
@@ -227,12 +227,12 @@
% \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
% -> the three temp registers contain flags, mantissa and exponent
\def\pgfmathfloat@decompose@tok#1#2{%
- \ifx#2Y%
- \expandafter\pgfmathfloat@decompose@tok@%
- \else
- \expandafter\pgfmathfloat@decompose@tok@error%
- \fi
- #1#2%
+ \ifx#2Y%
+ \expandafter\pgfmathfloat@decompose@tok@%
+ \else
+ \expandafter\pgfmathfloat@decompose@tok@error%
+ \fi
+ #1#2%
}%
\def\pgfmathfloat@decompose@tok@#1Y#2e#3]\relax#4#5#6{%
#4=#1\relax
@@ -243,44 +243,44 @@
% \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@a@S
% -> \pgfmathfloat@a@S contains the flags field.
\def\pgfmathfloat@decompose@F#1#2{%
- \ifx#2Y%
- \expandafter\pgfmathfloat@decompose@F@%
- \else
- \expandafter\pgfmathfloat@decompose@F@error%
- \fi
- #1#2%
+ \ifx#2Y%
+ \expandafter\pgfmathfloat@decompose@F@%
+ \else
+ \expandafter\pgfmathfloat@decompose@F@error%
+ \fi
+ #1#2%
}%
\def\pgfmathfloat@decompose@Fmacro#1#2{%
- \ifx#2Y%
- \expandafter\pgfmathfloat@decompose@Fmacro@%
- \else
- \expandafter\pgfmathfloat@decompose@F@error%
- \fi
- #1#2%
+ \ifx#2Y%
+ \expandafter\pgfmathfloat@decompose@Fmacro@%
+ \else
+ \expandafter\pgfmathfloat@decompose@F@error%
+ \fi
+ #1#2%
}%
\def\pgfmathfloat@decompose@M#1#2{%
- \ifx#2Y%
- \expandafter\pgfmathfloat@decompose@M@%
- \else
- \expandafter\pgfmathfloat@decompose@M@error%
- \fi
- #1#2%
+ \ifx#2Y%
+ \expandafter\pgfmathfloat@decompose@M@%
+ \else
+ \expandafter\pgfmathfloat@decompose@M@error%
+ \fi
+ #1#2%
}%
\def\pgfmathfloat@decompose@E#1#2{%
- \ifx#2Y%
- \expandafter\pgfmathfloat@decompose@E@%
- \else
- \expandafter\pgfmathfloat@decompose@E@error%
- \fi
- #1#2%
+ \ifx#2Y%
+ \expandafter\pgfmathfloat@decompose@E@%
+ \else
+ \expandafter\pgfmathfloat@decompose@E@error%
+ \fi
+ #1#2%
}%
\def\pgfmathfloat@decompose@Mtok#1#2{%
- \ifx#2Y%
- \expandafter\pgfmathfloat@decompose@Mtok@%
- \else
- \expandafter\pgfmathfloat@decompose@Mtok@error%
- \fi
- #1#2%
+ \ifx#2Y%
+ \expandafter\pgfmathfloat@decompose@Mtok@%
+ \else
+ \expandafter\pgfmathfloat@decompose@Mtok@error%
+ \fi
+ #1#2%
}%
\def\pgfmathfloat@decompose@F@#1Y#2e#3]\relax#4{#4=#1\relax}%
\def\pgfmathfloat@decompose@Fmacro@#1Y#2e#3]\relax#4{\def#4{#1}}%
@@ -289,67 +289,67 @@
\def\pgfmathfloat@decompose@E@#1Y#2e#3]\relax#4{#4=#3\relax}%
\def\pgfmathfloat@decompose@error#1\relax#2#3#4{%
- \begingroup
- \pgfmathfloatparsenumber@handleerror{wrong lowlevel format}{#1}{#1}%
- \xdef\pgfmathfloat@decompose@TMP{%
- \noexpand#2=\the\pgfmathfloat@a@S\space
- \noexpand#3=\the\pgfmathfloat@a@Mtok pt
- \noexpand#4=\the\pgfmathfloat@a@E\space
- }%
- \endgroup
- \pgfmathfloat@decompose@TMP
+ \begingroup
+ \pgfmathfloatparsenumber@handleerror{wrong lowlevel format}{#1}{#1}%
+ \xdef\pgfmathfloat@decompose@TMP{%
+ \noexpand#2=\the\pgfmathfloat@a@S\space
+ \noexpand#3=\the\pgfmathfloat@a@Mtok pt
+ \noexpand#4=\the\pgfmathfloat@a@E\space
+ }%
+ \endgroup
+ \pgfmathfloat@decompose@TMP
}%
\def\pgfmathfloat@decompose@tok@error#1\relax#2#3#4{%
- \begingroup
- \pgfmathfloatparsenumber@handleerror{wrong lowlevel format}{#1}{#1}%
- \xdef\pgfmathfloat@decompose@TMP{%
- \noexpand#2=\the\pgfmathfloat@a@S\space
- \noexpand#3={\the\pgfmathfloat@a@Mtok}%
- \noexpand#4=\the\pgfmathfloat@a@E\space
- }%
- \endgroup
- \pgfmathfloat@decompose@TMP
+ \begingroup
+ \pgfmathfloatparsenumber@handleerror{wrong lowlevel format}{#1}{#1}%
+ \xdef\pgfmathfloat@decompose@TMP{%
+ \noexpand#2=\the\pgfmathfloat@a@S\space
+ \noexpand#3={\the\pgfmathfloat@a@Mtok}%
+ \noexpand#4=\the\pgfmathfloat@a@E\space
+ }%
+ \endgroup
+ \pgfmathfloat@decompose@TMP
}%
\def\pgfmathfloat@decompose@F@error#1\relax#2{%
- \begingroup
- \pgfmathfloatparsenumber@handleerror{wrong lowlevel format}{#1}{#1}%
- \xdef\pgfmathfloat@decompose@TMP{\noexpand#2=\the\pgfmathfloat@a@S\space}%
- \endgroup
- \pgfmathfloat@decompose@TMP
+ \begingroup
+ \pgfmathfloatparsenumber@handleerror{wrong lowlevel format}{#1}{#1}%
+ \xdef\pgfmathfloat@decompose@TMP{\noexpand#2=\the\pgfmathfloat@a@S\space}%
+ \endgroup
+ \pgfmathfloat@decompose@TMP
}%
\def\pgfmathfloat@decompose@M@error#1\relax#2{%
- \begingroup
- \pgfmathfloatparsenumber@handleerror{wrong lowlevel format}{#1}{#1}%
- \xdef\pgfmathfloat@decompose@TMP{\noexpand#2=\the\pgfmathfloat@a@Mtok pt }%
- \endgroup
- \pgfmathfloat@decompose@TMP
+ \begingroup
+ \pgfmathfloatparsenumber@handleerror{wrong lowlevel format}{#1}{#1}%
+ \xdef\pgfmathfloat@decompose@TMP{\noexpand#2=\the\pgfmathfloat@a@Mtok pt }%
+ \endgroup
+ \pgfmathfloat@decompose@TMP
}%
\def\pgfmathfloat@decompose@Mtok@error#1\relax#2{%
- \begingroup
- \pgfmathfloatparsenumber@handleerror{wrong lowlevel format}{#1}{#1}%
- \xdef\pgfmathfloat@decompose@TMP{\noexpand#2={\the\pgfmathfloat@a@Mtok}}%
- \endgroup
- \pgfmathfloat@decompose@TMP
+ \begingroup
+ \pgfmathfloatparsenumber@handleerror{wrong lowlevel format}{#1}{#1}%
+ \xdef\pgfmathfloat@decompose@TMP{\noexpand#2={\the\pgfmathfloat@a@Mtok}}%
+ \endgroup
+ \pgfmathfloat@decompose@TMP
}%
\def\pgfmathfloat@decompose@E@error#1\relax#2{%
- \begingroup
- \pgfmathfloatparsenumber@handleerror{wrong lowlevel format}{#1}{#1}%
- \xdef\pgfmathfloat@decompose@TMP{\noexpand#2=\the\pgfmathfloat@a@E\space}%
- \endgroup
- \pgfmathfloat@decompose@TMP
+ \begingroup
+ \pgfmathfloatparsenumber@handleerror{wrong lowlevel format}{#1}{#1}%
+ \xdef\pgfmathfloat@decompose@TMP{\noexpand#2=\the\pgfmathfloat@a@E\space}%
+ \endgroup
+ \pgfmathfloat@decompose@TMP
}%
% Takes a floating point number #1 as input and writes flags to macro
% #2, mantissa to macro #3 and exponent to macro #4.
\def\pgfmathfloattomacro#1#2#3#4{%
- \begingroup
- \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
- \xdef\pgfmathfloat@glob@TMP{%
- \noexpand\def\noexpand#2{\the\pgfmathfloat@a@S}%
- \noexpand\def\noexpand#3{\the\pgfmathfloat@a@Mtok}%
- \noexpand\def\noexpand#4{\the\pgfmathfloat@a@E}%
- }%
- \endgroup
- \pgfmathfloat@glob@TMP
+ \begingroup
+ \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
+ \xdef\pgfmathfloat@glob@TMP{%
+ \noexpand\def\noexpand#2{\the\pgfmathfloat@a@S}%
+ \noexpand\def\noexpand#3{\the\pgfmathfloat@a@Mtok}%
+ \noexpand\def\noexpand#4{\the\pgfmathfloat@a@E}%
+ }%
+ \endgroup
+ \pgfmathfloat@glob@TMP
}
@@ -358,7 +358,7 @@
%
% All arguments are characters and will be expanded using '\edef'.
\def\pgfmathfloatcreate#1#2#3{%
- \edef\pgfmathresult{#1Y#2e#3]}%
+ \edef\pgfmathresult{#1Y#2e#3]}%
}%
% This is the character present in any low-level floating point
% number. It is assumed to be the SECOND character of a float (after
@@ -373,54 +373,54 @@
% \pgfmathfloattofixed{142e1}
% -> \pgfmathresult = 42.0
\def\pgfmathfloattofixed@#1{%
- \begingroup
- \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
- \ifcase\pgfmathfloat@a@S
- \def\pgfmathresult{0.0}%
- \or
- \expandafter\pgfmathfloattofixed@impl\the\pgfmathfloat@a@Mtok\relax
- \or
- \expandafter\pgfmathfloattofixed@impl\the\pgfmathfloat@a@Mtok\relax
- \pgfmathfloat@a@Mtok=\expandafter{\pgfmathresult}%
- \edef\pgfmathresult{-\the\pgfmathfloat@a@Mtok}%
- \or\def\pgfmathresult{nan}%
- \or\def\pgfmathresult{inf}%
- \or\def\pgfmathresult{-inf}%
- \fi
- \pgfmath@smuggleone\pgfmathresult
- \endgroup
+ \begingroup
+ \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
+ \ifcase\pgfmathfloat@a@S
+ \def\pgfmathresult{0.0}%
+ \or
+ \expandafter\pgfmathfloattofixed@impl\the\pgfmathfloat@a@Mtok\relax
+ \or
+ \expandafter\pgfmathfloattofixed@impl\the\pgfmathfloat@a@Mtok\relax
+ \pgfmathfloat@a@Mtok=\expandafter{\pgfmathresult}%
+ \edef\pgfmathresult{-\the\pgfmathfloat@a@Mtok}%
+ \or\def\pgfmathresult{nan}%
+ \or\def\pgfmathresult{inf}%
+ \or\def\pgfmathresult{-inf}%
+ \fi
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
}
\let\pgfmathfloattofixed=\pgfmathfloattofixed@
% Converts a float to an integer (in integer format).
%
-% @see \pgfmathfloatint
+% @see \pgfmathfloatint
\def\pgfmathfloattoint#1{%
- \pgfmathfloattofixed{#1}%
- \expandafter\pgfmathfloattoint@@\pgfmathresult\relax
+ \pgfmathfloattofixed{#1}%
+ \expandafter\pgfmathfloattoint@@\pgfmathresult\relax
}%
\def\pgfmathfloattoint@@#1.#2\relax{%
- \def\pgfmathresult{#1}%
+ \def\pgfmathresult{#1}%
}%
% Converts a floating point number to scientific format 1.234e5.
%
% This operation is very fast.
\def\pgfmathfloattosci@#1{%
- \begingroup
- \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
- \ifcase\pgfmathfloat@a@S
- \def\pgfmathresult{0.0e0}%
- \or
- \edef\pgfmathresult{\the\pgfmathfloat@a@Mtok e\the\pgfmathfloat@a@E}%
- \or
- \edef\pgfmathresult{-\the\pgfmathfloat@a@Mtok e\the\pgfmathfloat@a@E}%
- \or\def\pgfmathresult{nan}%
- \or\def\pgfmathresult{inf}%
- \or\def\pgfmathresult{-inf}%
- \fi
- \pgfmath@smuggleone\pgfmathresult
- \endgroup
+ \begingroup
+ \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
+ \ifcase\pgfmathfloat@a@S
+ \def\pgfmathresult{0.0e0}%
+ \or
+ \edef\pgfmathresult{\the\pgfmathfloat@a@Mtok e\the\pgfmathfloat@a@E}%
+ \or
+ \edef\pgfmathresult{-\the\pgfmathfloat@a@Mtok e\the\pgfmathfloat@a@E}%
+ \or\def\pgfmathresult{nan}%
+ \or\def\pgfmathresult{inf}%
+ \or\def\pgfmathresult{-inf}%
+ \fi
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
}%
\let\pgfmathfloattosci=\pgfmathfloattosci@
@@ -430,36 +430,36 @@
\def\pgfmathfloatvalueof#1{\expandafter\pgfmathfloatvalueof@@#1@@}%
% Make it fool proof such that the following arguments work:
-% \pgfmathfloatvalueof{1Y1.0e1} -> 1.0e1
-% \pgfmathfloatvalueof{2Y1.0e1} -> -1.0e1
+% \pgfmathfloatvalueof{1Y1.0e1} -> 1.0e1
+% \pgfmathfloatvalueof{2Y1.0e1} -> -1.0e1
% and wrong arguments as well:
-% \pgfmathfloatvalueof{1} -> 1
-% \pgfmathfloatvalueof{1e2} -> 1e2
+% \pgfmathfloatvalueof{1} -> 1
+% \pgfmathfloatvalueof{1e2} -> 1e2
\def\pgfmathfloatvalueof@@#1#2{%
- \if#2Y%
- % keep in mind that \pgfmathfloatvalueof should be expandable!
- % We must not use \let here. Let's hope that #1 and #2 are
- % single tokens (not something which was enclosed by curly
- % braces...)
- \expandafter\pgfmathfloatvalueof@@@\expandafter#1\expandafter#2%
- \else
- % Oh - no float!? Ok, we cannot report errors in this context.
- % So: make it a feature and return the input argument as-is.
- % Might be useful, in fact...
- \expandafter\pgfmathfloatvalueof@abort\expandafter#1\expandafter#2%
- \fi
+ \if#2Y%
+ % keep in mind that \pgfmathfloatvalueof should be expandable!
+ % We must not use \let here. Let's hope that #1 and #2 are
+ % single tokens (not something which was enclosed by curly
+ % braces...)
+ \expandafter\pgfmathfloatvalueof@@@\expandafter#1\expandafter#2%
+ \else
+ % Oh - no float!? Ok, we cannot report errors in this context.
+ % So: make it a feature and return the input argument as-is.
+ % Might be useful, in fact...
+ \expandafter\pgfmathfloatvalueof@abort\expandafter#1\expandafter#2%
+ \fi
}
\def\pgfmathfloatvalueof@@@#1Y#2e#3]@@{%
- \ifcase#1 %
- 0.0e0%
- \or
- #2e#3%
- \or
- -#2e#3%
- \or nan%
- \or inf%
- \or -inf%
- \fi
+ \ifcase#1 %
+ 0.0e0%
+ \or
+ #2e#3%
+ \or
+ -#2e#3%
+ \or nan%
+ \or inf%
+ \or -inf%
+ \fi
}%
\def\pgfmathfloatvalueof@abort#1@@{#1}%
@@ -472,7 +472,7 @@
% See \pgfmathroundtozerofill if you want trailing zeros and fixed
% width.
%
-% This method is PURELY text based and can work with arbirtrary
+% This method is PURELY text based and can work with arbitrary
% precision (well, limited to TeX's stack size and integer size).
%
% Examples:
@@ -487,16 +487,16 @@
%
% SIDE EFFECT: the global variable \ifpgfmathfloatroundhasperiod will be set.
\def\pgfmathroundto#1{%
- \pgfmathfloatroundhasperiodtrue
- \begingroup
- \pgfmathfloat@fixed@digits@after@periodfalse
- \pgfmathroundto@impl{#1}%
- \pgfmath@smuggleone\pgfmathresult
- \endgroup
+ \pgfmathfloatroundhasperiodtrue
+ \begingroup
+ \pgfmathfloat@fixed@digits@after@periodfalse
+ \pgfmathroundto@impl{#1}%
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
}
-% Overloaded method.
+% Overloaded method.
%
% This variant always uses a FIXED number behind the period and fills
% in zeros if necessary.
@@ -509,255 +509,255 @@
%
% SIDE EFFECT: the global variable \ifpgfmathfloatroundhasperiod will be set.
\def\pgfmathroundtozerofill#1{%
- \pgfmathfloatroundhasperiodtrue
- \begingroup
- \pgfmathfloat@fixed@digits@after@periodtrue
- \pgfmathroundto@impl{#1}%
- \pgfmath@smuggleone\pgfmathresult
- \endgroup
+ \pgfmathfloatroundhasperiodtrue
+ \begingroup
+ \pgfmathfloat@fixed@digits@after@periodtrue
+ \pgfmathroundto@impl{#1}%
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
}
% see \pgfmathprintnumber@fixed@style for docs
\def\pgfmathprintnumber@fixed@styleDEFAULT#1#2#3e#4\relax{%
- \begingroup
- \pgfkeysgetvalue{/pgf/number format/set decimal separator}\pgfmathprintnumber@fixed@styleDEFAULT@DEC@SEP
- \pgfkeysgetvalue{/pgf/number format/@dec sep mark}\pgfmathprintnumber@fixed@styleDEFAULT@DEC@SEP@MARK
- \pgfkeysgetvalue{/pgf/number format/set thousands separator}\pgfmathprintnumber@fixed@styleDEFAULT@THOUSAND@SEP
- \c@pgf@counta=#4\relax % it is the exponent here.
- \ifnum#2=0
- \c@pgf@counta=0
- \fi
- \def\pgfmathresult{}%
- \ifpgfmathfloatroundhasperiod
- \expandafter\pgfmathprintnumber@fixed@styleDEFAULT@impl@period#1\pgfmathfloat@EOI
- \else
- \expandafter\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod#1\pgfmathfloat@EOI\pgfmathfloat@EOI\pgfmathfloat@EOI%
- \begingroup
- \toks0=\expandafter{\pgfmathresult}%
- \toks1=\expandafter{\pgfmathprintnumber@fixed@styleDEFAULT@DEC@SEP@MARK}%
- \xdef\pgfmathfloat@glob@TMP{\the\toks0 \the\toks1 }%
- \endgroup
- \let\pgfmathresult=\pgfmathfloat@glob@TMP
- \fi
- \pgfmath@smuggleone\pgfmathresult
- \endgroup
+ \begingroup
+ \pgfkeysgetvalue{/pgf/number format/set decimal separator}\pgfmathprintnumber@fixed@styleDEFAULT@DEC@SEP
+ \pgfkeysgetvalue{/pgf/number format/@dec sep mark}\pgfmathprintnumber@fixed@styleDEFAULT@DEC@SEP@MARK
+ \pgfkeysgetvalue{/pgf/number format/set thousands separator}\pgfmathprintnumber@fixed@styleDEFAULT@THOUSAND@SEP
+ \c@pgf@counta=#4\relax % it is the exponent here.
+ \ifnum#2=0
+ \c@pgf@counta=0
+ \fi
+ \def\pgfmathresult{}%
+ \ifpgfmathfloatroundhasperiod
+ \expandafter\pgfmathprintnumber@fixed@styleDEFAULT@impl@period#1\pgfmathfloat@EOI
+ \else
+ \expandafter\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod#1\pgfmathfloat@EOI\pgfmathfloat@EOI\pgfmathfloat@EOI%
+ \begingroup
+ \toks0=\expandafter{\pgfmathresult}%
+ \toks1=\expandafter{\pgfmathprintnumber@fixed@styleDEFAULT@DEC@SEP@MARK}%
+ \xdef\pgfmathfloat@glob@TMP{\the\toks0 \the\toks1 }%
+ \endgroup
+ \let\pgfmathresult=\pgfmathfloat@glob@TMP
+ \fi
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
}
\def\pgfmathprintnumber@fixed@styleDEFAULT@impl@period#1.#2\pgfmathfloat@EOI{%
- \ifpgfmathprintnumberskipzeroperiod
- \def\pgfmathfloat@loc@TMPb{#1}%
- \ifx\pgfmathfloatparsenumber@tok@ZERO\pgfmathfloat@loc@TMPb
- \else
- \def\pgfmathfloat@loc@TMPc{-0}%
- \ifx\pgfmathfloat@loc@TMPc\pgfmathfloat@loc@TMPb
- \def\pgfmathresult{-}%
- \else
- \def\pgfmathfloat@loc@TMPc{+0}%
- \ifx\pgfmathfloat@loc@TMPc\pgfmathfloat@loc@TMPb
- \def\pgfmathresult{+}%
- \else
- \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod#1\pgfmathfloat@EOI\pgfmathfloat@EOI\pgfmathfloat@EOI
- \fi
- \fi
- \fi
- \else
- \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod#1\pgfmathfloat@EOI\pgfmathfloat@EOI\pgfmathfloat@EOI
- \fi
- \ifpgfmathprintnumber@thousand@sep@in@fractional
- \let\pgfmathresultfractional\pgfutil@empty%
- \pgfmathprintnumber@thousand@sep@in@fractional#2MMMM\@@
- \else
- \def\pgfmathresultfractional{#2}%
- \fi
- \begingroup
- \toks0=\expandafter{\pgfmathresult}%
- \toks1=\expandafter{\pgfmathprintnumber@fixed@styleDEFAULT@DEC@SEP@MARK}%
- \toks2=\expandafter{\pgfmathprintnumber@fixed@styleDEFAULT@DEC@SEP}%
- \toks3=\expandafter{\pgfmathresultfractional}%
- \xdef\pgfmathfloat@glob@TMP{\the\toks0 \the\toks1 \the\toks2 \the\toks3 }%
- \endgroup
- \let\pgfmathresult=\pgfmathfloat@glob@TMP
+ \ifpgfmathprintnumberskipzeroperiod
+ \def\pgfmathfloat@loc@TMPb{#1}%
+ \ifx\pgfmathfloatparsenumber@tok@ZERO\pgfmathfloat@loc@TMPb
+ \else
+ \def\pgfmathfloat@loc@TMPc{-0}%
+ \ifx\pgfmathfloat@loc@TMPc\pgfmathfloat@loc@TMPb
+ \def\pgfmathresult{-}%
+ \else
+ \def\pgfmathfloat@loc@TMPc{+0}%
+ \ifx\pgfmathfloat@loc@TMPc\pgfmathfloat@loc@TMPb
+ \def\pgfmathresult{+}%
+ \else
+ \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod#1\pgfmathfloat@EOI\pgfmathfloat@EOI\pgfmathfloat@EOI
+ \fi
+ \fi
+ \fi
+ \else
+ \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod#1\pgfmathfloat@EOI\pgfmathfloat@EOI\pgfmathfloat@EOI
+ \fi
+ \ifpgfmathprintnumber@thousand@sep@in@fractional
+ \let\pgfmathresultfractional\pgfutil@empty%
+ \pgfmathprintnumber@thousand@sep@in@fractional#2MMMM\@@
+ \else
+ \def\pgfmathresultfractional{#2}%
+ \fi
+ \begingroup
+ \toks0=\expandafter{\pgfmathresult}%
+ \toks1=\expandafter{\pgfmathprintnumber@fixed@styleDEFAULT@DEC@SEP@MARK}%
+ \toks2=\expandafter{\pgfmathprintnumber@fixed@styleDEFAULT@DEC@SEP}%
+ \toks3=\expandafter{\pgfmathresultfractional}%
+ \xdef\pgfmathfloat@glob@TMP{\the\toks0 \the\toks1 \the\toks2 \the\toks3 }%
+ \endgroup
+ \let\pgfmathresult=\pgfmathfloat@glob@TMP
}%
% assigns \pgfmathresult such that it contains the formatted result.
% It assumes that none of the following tokens contains a period.
\def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod{%
- \ifx\pgfmathprintnumber@fixed@styleDEFAULT@THOUSAND@SEP\pgfutil@empty
- \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{%
- \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printall}%
- \else
- \ifnum\c@pgf@counta<0\relax % exponent of the number in this context
- \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{%
- \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printall}%
- \else
- \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
+ \ifx\pgfmathprintnumber@fixed@styleDEFAULT@THOUSAND@SEP\pgfutil@empty
+ \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{%
+ \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printall}%
+ \else
+ \ifnum\c@pgf@counta<0\relax % exponent of the number in this context
+ \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{%
+ \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printall}%
+ \else
+ \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
}
\def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printsign#1{%
- \def\pgfmathfloat@loc@TMPb{#1}%
- \ifx\pgfmathfloat@loc@TMPb\pgfmathfloatparsenumber@tok@MINUS
- \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult #1}%
- \let\pgfmathfloat@loc@TMPb=\pgfutil@empty
- \else
- \ifx\pgfmathfloat@loc@TMPb\pgfmathfloatparsenumber@tok@PLUS
- \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult #1}%
- \let\pgfmathfloat@loc@TMPb=\pgfutil@empty
- \else
- \ifpgfmathprintnumber@showpositive
- \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult +}%
- \fi
- \fi
- \fi
- \ifnum\c@pgf@counta>0 % \c@pgf@counta = N MOD 3 in this context
- \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{%
- \expandafter\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printtrailingdigits\pgfmathfloat@loc@TMPb
- }%
- \else
- \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{%
- \expandafter\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@counteverythird\pgfmathfloat@loc@TMPb
- }%
- \fi
- \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT
+ \def\pgfmathfloat@loc@TMPb{#1}%
+ \ifx\pgfmathfloat@loc@TMPb\pgfmathfloatparsenumber@tok@MINUS
+ \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult #1}%
+ \let\pgfmathfloat@loc@TMPb=\pgfutil@empty
+ \else
+ \ifx\pgfmathfloat@loc@TMPb\pgfmathfloatparsenumber@tok@PLUS
+ \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult #1}%
+ \let\pgfmathfloat@loc@TMPb=\pgfutil@empty
+ \else
+ \ifpgfmathprintnumber@showpositive
+ \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult +}%
+ \fi
+ \fi
+ \fi
+ \ifnum\c@pgf@counta>0 % \c@pgf@counta = N MOD 3 in this context
+ \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{%
+ \expandafter\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printtrailingdigits\pgfmathfloat@loc@TMPb
+ }%
+ \else
+ \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{%
+ \expandafter\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@counteverythird\pgfmathfloat@loc@TMPb
+ }%
+ \fi
+ \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT
}
\def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printtrailingdigits#1#2{%
- \ifcase\c@pgf@counta % = N MOD 3 in this context
- % does not happen per construction
- \or
- \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult #1}%
- \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{%
- \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@counteverythird#2%
- }%
- \or
- \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult #1#2}%
- \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{%
- \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@counteverythird%
- }%
- \fi
- \ifnum\c@pgf@countb>0\relax % \c@pgf@countb = N DIV 3 in this context
- \begingroup
- \toks0=\expandafter{\pgfmathresult}%
- \toks1=\expandafter{\pgfmathprintnumber@fixed@styleDEFAULT@THOUSAND@SEP}%
- \xdef\pgfmathfloat@glob@TMP{\the\toks0 \the\toks1 }%
- \endgroup
- \let\pgfmathresult=\pgfmathfloat@glob@TMP
- \fi
- \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT
+ \ifcase\c@pgf@counta % = N MOD 3 in this context
+ % does not happen per construction
+ \or
+ \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult #1}%
+ \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{%
+ \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@counteverythird#2%
+ }%
+ \or
+ \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult #1#2}%
+ \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{%
+ \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@counteverythird%
+ }%
+ \fi
+ \ifnum\c@pgf@countb>0\relax % \c@pgf@countb = N DIV 3 in this context
+ \begingroup
+ \toks0=\expandafter{\pgfmathresult}%
+ \toks1=\expandafter{\pgfmathprintnumber@fixed@styleDEFAULT@THOUSAND@SEP}%
+ \xdef\pgfmathfloat@glob@TMP{\the\toks0 \the\toks1 }%
+ \endgroup
+ \let\pgfmathresult=\pgfmathfloat@glob@TMP
+ \fi
+ \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT
}
\def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@counteverythird#1#2#3{%
- \ifnum\c@pgf@countb>0\relax
- \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult #1#2#3}%
- \advance\c@pgf@countb by-1
- \ifnum\c@pgf@countb>0\relax
- \begingroup
- \toks0=\expandafter{\pgfmathresult}%
- \toks1=\expandafter{\pgfmathprintnumber@fixed@styleDEFAULT@THOUSAND@SEP}%
- \xdef\pgfmathfloat@glob@TMP{\the\toks0 \the\toks1 }%
- \endgroup
- \let\pgfmathresult=\pgfmathfloat@glob@TMP
- \fi
- \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{%
- \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@counteverythird%
- }%
- \else
- % in thise case, #1#2#3 are expected to be
- % \pgfmathfloat@EOI\pgfmathfloat@EOI\pgfmathfloat@EOI
- %--------------------------------------------------
- % \def\pgfmathfloat@loc@TMPb{\pgfmathfloat@EOI\pgfmathfloat@EOI\pgfmathfloat@EOI}%
- % \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}{}%
- % \fi
- %--------------------------------------------------
- \let\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT=\relax
- \fi
- \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT
+ \ifnum\c@pgf@countb>0\relax
+ \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult #1#2#3}%
+ \advance\c@pgf@countb by-1
+ \ifnum\c@pgf@countb>0\relax
+ \begingroup
+ \toks0=\expandafter{\pgfmathresult}%
+ \toks1=\expandafter{\pgfmathprintnumber@fixed@styleDEFAULT@THOUSAND@SEP}%
+ \xdef\pgfmathfloat@glob@TMP{\the\toks0 \the\toks1 }%
+ \endgroup
+ \let\pgfmathresult=\pgfmathfloat@glob@TMP
+ \fi
+ \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{%
+ \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@counteverythird%
+ }%
+ \else
+ % in this case, #1#2#3 are expected to be
+ % \pgfmathfloat@EOI\pgfmathfloat@EOI\pgfmathfloat@EOI
+ %--------------------------------------------------
+ % \def\pgfmathfloat@loc@TMPb{\pgfmathfloat@EOI\pgfmathfloat@EOI\pgfmathfloat@EOI}%
+ % \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}{}%
+ % \fi
+ %--------------------------------------------------
+ \let\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT=\relax
+ \fi
+ \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT
}
% \pgfmathprintnumber@thousand@sep@in@fractional 01234525MMMM\@@
% ->
% 012<sep>345<sep>25
\def\pgfmathprintnumber@thousand@sep@in@fractional#1#2#3#4{%
- \if#4M%
- % Ok, no further separator
- \def\pgfmathprint@next{\pgfmathprintnumber@thousand@sep@in@fractional@finish#1#2#3#4}%
- \else
- \begingroup
- \toks0=\expandafter{\pgfmathresultfractional}%
- \toks1={#1#2#3}%
- \toks2=\expandafter{\pgfmathprintnumber@fixed@styleDEFAULT@THOUSAND@SEP}%
- \xdef\pgfmathfloat@glob@TMP{\the\toks0 \the\toks1 \the\toks2 }%
- \endgroup
- \let\pgfmathresultfractional=\pgfmathfloat@glob@TMP
- \def\pgfmathprint@next{\pgfmathprintnumber@thousand@sep@in@fractional#4}%
- \fi
- \pgfmathprint@next
+ \if#4M%
+ % Ok, no further separator
+ \def\pgfmathprint@next{\pgfmathprintnumber@thousand@sep@in@fractional@finish#1#2#3#4}%
+ \else
+ \begingroup
+ \toks0=\expandafter{\pgfmathresultfractional}%
+ \toks1={#1#2#3}%
+ \toks2=\expandafter{\pgfmathprintnumber@fixed@styleDEFAULT@THOUSAND@SEP}%
+ \xdef\pgfmathfloat@glob@TMP{\the\toks0 \the\toks1 \the\toks2 }%
+ \endgroup
+ \let\pgfmathresultfractional=\pgfmathfloat@glob@TMP
+ \def\pgfmathprint@next{\pgfmathprintnumber@thousand@sep@in@fractional#4}%
+ \fi
+ \pgfmathprint@next
}%
\def\pgfmathprintnumber@thousand@sep@in@fractional@finish#1M{%
- \expandafter\def\expandafter\pgfmathresultfractional\expandafter{\pgfmathresultfractional #1}%
- \pgfmathprintnumber@thousand@sep@in@fractional@finish@
+ \expandafter\def\expandafter\pgfmathresultfractional\expandafter{\pgfmathresultfractional #1}%
+ \pgfmathprintnumber@thousand@sep@in@fractional@finish@
}%
\def\pgfmathprintnumber@thousand@sep@in@fractional@finish@#1\@@{}%
\def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printall#1{%
- \def\pgfmathfloat@loc@TMPb{#1}%
- \let\pgfmathfloat@loc@TMPc=\pgfutil@empty
- \ifx\pgfmathfloat@loc@TMPb\pgfmathfloatparsenumber@tok@MINUS
- \else
- \ifx\pgfmathfloat@loc@TMPb\pgfmathfloatparsenumber@tok@PLUS
- \else
- \ifpgfmathprintnumber@showpositive
- \def\pgfmathfloat@loc@TMPc{+}%
- \fi
- \fi
- \fi
- \expandafter\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printall@\pgfmathfloat@loc@TMPc#1%
+ \def\pgfmathfloat@loc@TMPb{#1}%
+ \let\pgfmathfloat@loc@TMPc=\pgfutil@empty
+ \ifx\pgfmathfloat@loc@TMPb\pgfmathfloatparsenumber@tok@MINUS
+ \else
+ \ifx\pgfmathfloat@loc@TMPb\pgfmathfloatparsenumber@tok@PLUS
+ \else
+ \ifpgfmathprintnumber@showpositive
+ \def\pgfmathfloat@loc@TMPc{+}%
+ \fi
+ \fi
+ \fi
+ \expandafter\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printall@\pgfmathfloat@loc@TMPc#1%
}
\def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printall@#1\pgfmathfloat@EOI\pgfmathfloat@EOI\pgfmathfloat@EOI{%
- \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult #1}%
+ \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult #1}%
}%
% @deprecated. It has been replaced by \pgfmathprintnumber@fixed@styleDEFAULT
% #1 maybe a macro
\def\pgfmathprintnumber@fixed@stylePERIOD#1#2#3e#4\relax{%
- \def\pgfmathresult{#1}%
+ \def\pgfmathresult{#1}%
}
% @deprecated. It has been replaced by \pgfmathprintnumber@fixed@styleDEFAULT
% #1 maybe a macro
\def\pgfmathprintnumber@fixed@styleCOMMA#1#2#3e#4\relax{%
- \ifpgfmathfloatroundhasperiod
- \expandafter\pgfmathprintnumber@fixed@styleCOMMA@impl#1\pgfmathfloat@EOI
- \else
- \def\pgfmathresult{#1}%
- \fi
+ \ifpgfmathfloatroundhasperiod
+ \expandafter\pgfmathprintnumber@fixed@styleCOMMA@impl#1\pgfmathfloat@EOI
+ \else
+ \def\pgfmathresult{#1}%
+ \fi
}
\def\pgfmathprintnumber@fixed@styleCOMMA@impl#1.#2\pgfmathfloat@EOI{\def\pgfmathresult{#1{,}#2}}
% The default style to display fixed point numbers.
%
-% It does not apply numerics, but it is responsable for typesetting the
+% It does not apply numerics, but it is responsible for typesetting the
% rounded number.
% It can access the \ifpgfmathfloatroundhasperiod boolean.
%
% Arguments:
% #1#2#3e#4\relax
-% Input:
+% 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. This format is returned (only!) by
@@ -766,7 +766,7 @@
\let\pgfmathprintnumber@fixed@style=\pgfmathprintnumber@fixed@styleDEFAULT
-% Rounds a normalized floating point number to \pgfmathfloat@round@precision
+% Rounds a normalized floating point number to \pgfmathfloat@round@precision
% digits precision and writes the result to \pgfmathresult.
%
% This method uses \pgfmathroundto for the mantissa.
@@ -776,13 +776,13 @@
% SIDE EFFECT: the global variable \ifpgfmathfloatroundhasperiod will be set to
% whether the final mantissa #5 has a period or not.
\def\pgfmathfloatround#1{%
- \pgfmathfloatroundhasperiodtrue
- \begingroup
- \pgfmathfloat@fixed@digits@after@periodfalse
- \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
- \pgfmathfloatround@impl
- \pgfmath@smuggleone\pgfmathresult
- \endgroup
+ \pgfmathfloatroundhasperiodtrue
+ \begingroup
+ \pgfmathfloat@fixed@digits@after@periodfalse
+ \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
+ \pgfmathfloatround@impl
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
}
% Overload.
@@ -795,13 +795,13 @@
% SIDE EFFECT: the global variable \ifpgfmathfloatroundhasperiod will be set to
% whether the final mantissa #5 has a period or not.
\def\pgfmathfloatroundzerofill#1{%
- \pgfmathfloatroundhasperiodtrue
- \begingroup
- \pgfmathfloat@fixed@digits@after@periodtrue
- \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
- \pgfmathfloatround@impl
- \pgfmath@smuggleone\pgfmathresult
- \endgroup
+ \pgfmathfloatroundhasperiodtrue
+ \begingroup
+ \pgfmathfloat@fixed@digits@after@periodtrue
+ \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
+ \pgfmathfloatround@impl
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
}
\newif\ifpgfmathfloatround@allow@empty@mantissa
@@ -811,134 +811,134 @@
% #2: mantissa
% #3: exponent
% #4: CODE to display if the mantissa is drawn.
-% This code will be shown just before the exponent.
-% Example: #4=\cdot
+% This code will be shown just before the exponent.
+% Example: #4=\cdot
% #5: CODE to display if the mantissa is NOT draw. (unused currently)
-% Might be used to display '10^1' instead of '1*10^1'.
+% Might be used to display '10^1' instead of '1*10^1'.
% #6: CODE to display the exponent.
\def\pgfmathfloatrounddisplaystyle@shared@impl#1#2e#3\relax#4#5#6{%
- \pgfkeysgetvalue{/pgf/number format/@sci exponent mark}\pgfmathfloatrounddisplaystyle@e@mark
- \ifcase#1\relax
- \pgfmathprintnumber@fixed@style{#2}#1#2e0\relax%
- \expandafter\pgfmathfloatrounddisplaystyle@shared@impl@\expandafter{\pgfmathresult}{#4#6}%
- \or
- \def\pgfmathfloat@loc@TMPa{1}% "should draw mantissa=1"
- \ifpgfmathfloatround@allow@empty@mantissa
- \else
- \ifdim#2pt=\pgfmathfloatround@mantissa@ONE
- \def\pgfmathfloat@loc@TMPa{0}% do not draw it.
- \fi
- \fi
- %
- \if1\pgfmathfloat@loc@TMPa
- \pgfmathprintnumber@fixed@style{#2}#1#2e0\relax%
- \expandafter\pgfmathfloatrounddisplaystyle@shared@impl@\expandafter{\pgfmathresult}{#4#6}%
- \else
- \def\pgfmathfloat@loc@TMPa{0}%
- \pgfmathfloatrounddisplaystyle@shared@impl@{#5}{#6}%
- \fi
- \or
- \def\pgfmathfloat@loc@TMPa{1}% "should draw mantissa=1"
- \ifpgfmathfloatround@allow@empty@mantissa
- \else
- \ifdim#2pt=\pgfmathfloatround@mantissa@ONE
- \def\pgfmathfloat@loc@TMPa{0}% do not draw it.
- \fi
- \fi
- %
- \if1\pgfmathfloat@loc@TMPa
- \pgfmathprintnumber@fixed@style{-#2}#1#2e0\relax%
- \expandafter\pgfmathfloatrounddisplaystyle@shared@impl@\expandafter{\pgfmathresult}{#4#6}%
- \else
- \def\pgfmathfloat@loc@TMPa{0}%
- \pgfmathfloatrounddisplaystyle@shared@impl@{-#5}{#6}%
- \fi
- \or
- \pgfmathfloatrounddisplaystyle@shared@impl@@{\hbox{NaN}}{}%
- \or
- \ifpgfmathprintnumber@showpositive
- \pgfmathfloatrounddisplaystyle@shared@impl@@{+\infty}{}%
- \else
- \pgfmathfloatrounddisplaystyle@shared@impl@@{\infty}{}%
- \fi
- \or
- \pgfmathfloatrounddisplaystyle@shared@impl@@{-\infty}{}%
- \fi
+ \pgfkeysgetvalue{/pgf/number format/@sci exponent mark}\pgfmathfloatrounddisplaystyle@e@mark
+ \ifcase#1\relax
+ \pgfmathprintnumber@fixed@style{#2}#1#2e0\relax%
+ \expandafter\pgfmathfloatrounddisplaystyle@shared@impl@\expandafter{\pgfmathresult}{#4#6}%
+ \or
+ \def\pgfmathfloat@loc@TMPa{1}% "should draw mantissa=1"
+ \ifpgfmathfloatround@allow@empty@mantissa
+ \else
+ \ifdim#2pt=\pgfmathfloatround@mantissa@ONE
+ \def\pgfmathfloat@loc@TMPa{0}% do not draw it.
+ \fi
+ \fi
+ %
+ \if1\pgfmathfloat@loc@TMPa
+ \pgfmathprintnumber@fixed@style{#2}#1#2e0\relax%
+ \expandafter\pgfmathfloatrounddisplaystyle@shared@impl@\expandafter{\pgfmathresult}{#4#6}%
+ \else
+ \def\pgfmathfloat@loc@TMPa{0}%
+ \pgfmathfloatrounddisplaystyle@shared@impl@{#5}{#6}%
+ \fi
+ \or
+ \def\pgfmathfloat@loc@TMPa{1}% "should draw mantissa=1"
+ \ifpgfmathfloatround@allow@empty@mantissa
+ \else
+ \ifdim#2pt=\pgfmathfloatround@mantissa@ONE
+ \def\pgfmathfloat@loc@TMPa{0}% do not draw it.
+ \fi
+ \fi
+ %
+ \if1\pgfmathfloat@loc@TMPa
+ \pgfmathprintnumber@fixed@style{-#2}#1#2e0\relax%
+ \expandafter\pgfmathfloatrounddisplaystyle@shared@impl@\expandafter{\pgfmathresult}{#4#6}%
+ \else
+ \def\pgfmathfloat@loc@TMPa{0}%
+ \pgfmathfloatrounddisplaystyle@shared@impl@{-#5}{#6}%
+ \fi
+ \or
+ \pgfmathfloatrounddisplaystyle@shared@impl@@{\hbox{NaN}}{}%
+ \or
+ \ifpgfmathprintnumber@showpositive
+ \pgfmathfloatrounddisplaystyle@shared@impl@@{+\infty}{}%
+ \else
+ \pgfmathfloatrounddisplaystyle@shared@impl@@{\infty}{}%
+ \fi
+ \or
+ \pgfmathfloatrounddisplaystyle@shared@impl@@{-\infty}{}%
+ \fi
}
% #1: the part before the exponent code
% #2: the part for the exponent code.
\def\pgfmathfloatrounddisplaystyle@shared@impl@#1#2{%
- \pgfmathprintnumber@begingroup
- \toks0={#1}%
- \toks1=\expandafter{\pgfmathfloatrounddisplaystyle@e@mark #2}%
- \xdef\pgfmathfloat@glob@TMP{\the\toks0 \the\toks1 }%
- \pgfmathprintnumber@endgroup
- \let\pgfmathresult=\pgfmathfloat@glob@TMP
+ \pgfmathprintnumber@begingroup
+ \toks0={#1}%
+ \toks1=\expandafter{\pgfmathfloatrounddisplaystyle@e@mark #2}%
+ \xdef\pgfmathfloat@glob@TMP{\the\toks0 \the\toks1 }%
+ \pgfmathprintnumber@endgroup
+ \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{%
- \pgfmathprintnumber@begingroup
- \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 }%
- \pgfmathprintnumber@endgroup
- \let\pgfmathresult=\pgfmathfloat@glob@TMP
+ \pgfmathprintnumber@begingroup
+ \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 }%
+ \pgfmathprintnumber@endgroup
+ \let\pgfmathresult=\pgfmathfloat@glob@TMP
}
\def\pgfmathfloatrounddisplaystyle@std#1#2e#3\relax{%
- \pgfmathfloatrounddisplaystyle@shared@impl#1#2e#3\relax{\cdot}{}{10^{#3}}%
+ \pgfmathfloatrounddisplaystyle@shared@impl#1#2e#3\relax{\cdot}{}{10^{#3}}%
}
\def\pgfmathfloatrounddisplaystyle@subscript#1#2e#3\relax{%
- \pgfmathfloatrounddisplaystyle@shared@impl#1#2e#3\relax{}{1}{_{#3}}%
+ \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}}%
+ \pgfmathfloatrounddisplaystyle@shared@impl#1#2e#3\relax{}{1}{^{#3}}%
}
\def\pgfmathfloatrounddisplaystyle@e#1#2e#3\relax{%
- \ifnum#3<0\relax
- \pgfmathprintnumber@begingroup
- \count0=#3\relax
- \multiply\count0 by-1
- \xdef\pgfmathfloat@glob@TMP{e{-}\the\count0}%
- \pgfmathprintnumber@endgroup%
- \let\pgfmathresult=\pgfmathfloat@glob@TMP
- \else
- \def\pgfmathresult{e{+}#3}%
- \fi
- \def\pgfmathfloat@loc@TMPb{\pgfmathfloatrounddisplaystyle@shared@impl#1#2e#3\relax{}{1}}%
- \expandafter\pgfmathfloat@loc@TMPb\expandafter{\pgfmathresult}%
+ \ifnum#3<0\relax
+ \pgfmathprintnumber@begingroup
+ \count0=#3\relax
+ \multiply\count0 by-1
+ \xdef\pgfmathfloat@glob@TMP{e{-}\the\count0}%
+ \pgfmathprintnumber@endgroup%
+ \let\pgfmathresult=\pgfmathfloat@glob@TMP
+ \else
+ \def\pgfmathresult{e{+}#3}%
+ \fi
+ \def\pgfmathfloat@loc@TMPb{\pgfmathfloatrounddisplaystyle@shared@impl#1#2e#3\relax{}{1}}%
+ \expandafter\pgfmathfloat@loc@TMPb\expandafter{\pgfmathresult}%
}
\def\pgfmathfloatrounddisplaystyle@E#1#2e#3\relax{%
- \ifnum#3<0\relax
- \pgfmathprintnumber@begingroup
- \count0=#3\relax
- \multiply\count0 by-1
- \xdef\pgfmathfloat@glob@TMP{E{-}\the\count0}%
- \pgfmathprintnumber@endgroup%
- \let\pgfmathresult=\pgfmathfloat@glob@TMP
- \else
- \def\pgfmathresult{E{+}#3}%
- \fi
- \def\pgfmathfloat@loc@TMPb{\pgfmathfloatrounddisplaystyle@shared@impl#1#2e#3\relax{}{1}}%
- \expandafter\pgfmathfloat@loc@TMPb\expandafter{\pgfmathresult}%
+ \ifnum#3<0\relax
+ \pgfmathprintnumber@begingroup
+ \count0=#3\relax
+ \multiply\count0 by-1
+ \xdef\pgfmathfloat@glob@TMP{E{-}\the\count0}%
+ \pgfmathprintnumber@endgroup%
+ \let\pgfmathresult=\pgfmathfloat@glob@TMP
+ \else
+ \def\pgfmathresult{E{+}#3}%
+ \fi
+ \def\pgfmathfloat@loc@TMPb{\pgfmathfloatrounddisplaystyle@shared@impl#1#2e#3\relax{}{1}}%
+ \expandafter\pgfmathfloat@loc@TMPb\expandafter{\pgfmathresult}%
}
\def\pgfmathfloatrounddisplaystyle@generic#1#2e#3\relax{%
- \begingroup
- \pgfkeysvalueof {/pgf/number format/sci generic/@/.@cmd}{#3}{#1}{#2}\pgfeov
- \pgfkeysgetvalue{/pgf/number format/sci generic/mantissa sep}\pgfmathdisplay@aftermantissa
- \pgfkeysgetvalue{/pgf/number format/sci generic/empty mantissa sep}\pgfmathdisplay@nomantissa
- \pgfkeysgetvalue{/pgf/number format/sci generic/exponent}\pgfmathdisplay@e
- \toks0=\expandafter{\pgfmathdisplay@aftermantissa}%
- \toks1=\expandafter{\pgfmathdisplay@nomantissa}%
- \toks2=\expandafter{\pgfmathdisplay@e}%
- \xdef\pgfmathfloat@glob@TMP{\noexpand\pgfmathfloatrounddisplaystyle@shared@impl#1#2e#3\noexpand\relax{\the\toks0}{\the\toks1}{\the\toks2}}%
- \endgroup
- \pgfmathfloat@glob@TMP
+ \begingroup
+ \pgfkeysvalueof {/pgf/number format/sci generic/@/.@cmd}{#3}{#1}{#2}\pgfeov
+ \pgfkeysgetvalue{/pgf/number format/sci generic/mantissa sep}\pgfmathdisplay@aftermantissa
+ \pgfkeysgetvalue{/pgf/number format/sci generic/empty mantissa sep}\pgfmathdisplay@nomantissa
+ \pgfkeysgetvalue{/pgf/number format/sci generic/exponent}\pgfmathdisplay@e
+ \toks0=\expandafter{\pgfmathdisplay@aftermantissa}%
+ \toks1=\expandafter{\pgfmathdisplay@nomantissa}%
+ \toks2=\expandafter{\pgfmathdisplay@e}%
+ \xdef\pgfmathfloat@glob@TMP{\noexpand\pgfmathfloatrounddisplaystyle@shared@impl#1#2e#3\noexpand\relax{\the\toks0}{\the\toks1}{\the\toks2}}%
+ \endgroup
+ \pgfmathfloat@glob@TMP
}
% A macro which takes the argument '<SIGN><MANTISSE>e<EXPONENT>' and
@@ -947,7 +947,7 @@
%
% PRECONDITION:
% the floating point number has already been rounded properly and
-% the mantissa has been rounded correcty.
+% the mantissa has been rounded correctly.
%
% The argument needs to be in the format returned by
% \pgfmathfloat@to@FMeE@style and terminated by '\relax'.
@@ -971,331 +971,331 @@
\newif\ifpgfmathprintnumber@thousand@sep@in@fractional
\pgfkeys{%
- /pgf/number format/.is family,
- /pgf/number format,
- fixed/.code= \pgfmath@set@number@printer{pgfmathprintnumber@FIXED},
- sci/.code= \pgfmath@set@number@printer{pgfmathprintnumber@SCI},
- std/.code= {\pgfmath@set@number@printer{pgfmathprintnumber@STD}\pgfmathprintnumber@STD@setparam{#1}},
- std/.default=,%
- relative round mode/.is choice,
- relative round mode/fixed/.code={\def\pgfmathprintnumber@RELATIVE@choice@roundtofixed{1}},
- relative round mode/mantissa/.code={\def\pgfmathprintnumber@RELATIVE@choice@roundtofixed{0}},
- relative round mode/compatible/.code={\def\pgfmathprintnumber@RELATIVE@choice@roundtofixed{2}},
- % relative={<exponent base 10>}
- relative/.code= {%
- \pgfmath@set@number@printer{pgfmathprintnumber@RELATIVE}%
- \pgfmathround@@orig{#1}%
- \expandafter\pgfmathfloattoint@@\pgfmathresult\relax
- \let\pgfmathprintnumber@RELATIVE@param=\pgfmathresult
- },%
- relative/.value required,
- relative*/.style={/pgf/number format/relative={#1},/pgf/number format/relative round mode=fixed},
- every relative/.style=std,
- relative style/.style={/pgf/number format/every relative/.append style={#1}},
- fixed relative/.code= \pgfmath@set@number@printer{pgfmathprintnumber@FIXED@RELATIVE},
- int detect/.code= \pgfmath@set@number@printer{pgfmathprintnumber@INT@DETECT},
- int trunc/.code= \pgfmath@set@number@printer{pgfmathprintnumber@INT@TRUNC},
- frac/.code= \pgfmath@set@number@printer{pgfmathprintnumber@frac},%
- frac TeX/.initial=\frac,
- frac whole format/.code={\def\pgfmathresult{#1}},
- frac denom/.initial=,
- frac whole/.is if=pgfmathprintnumber@frac@whole,
- frac whole=true,
- frac shift/.initial=4,
- frac warning/.is if=pgfmathprintnumber@frac@warn,
- frac warning=true,
- assume math mode/.is if=pgfmathprintnumber@assumemathmode,
- assume math mode/.default=true,
- fixed zerofill/.is if= pgfmathfloat@usezerofill@fixed,
- fixed zerofill/.default=true,
- sci zerofill/.is if= pgfmathfloat@usezerofill@sci,
- sci zerofill/.default=true,
- zerofill/.style= {/pgf/number format/fixed zerofill=#1,/pgf/number format/sci zerofill=#1},
- zerofill/.default= true,
- precision/.store in= \pgfmathfloat@round@precision,
- sci precision/.code={%
- \edef\pgfmathfloat@loc@TMPa{#1}%
- \ifx\pgfmathfloat@loc@TMPa\pgfutil@empty
- \def\pgfmathprintnumber@sci@precision{\pgfmathfloat@round@precision}%
- \else
- \let\pgfmathprintnumber@sci@precision=\pgfmathfloat@loc@TMPa
- \fi
- },%
- sci precision/.default=,
- sci precision=,
- fixed default/.code= {\let\pgfmathprintnumber@fixed@style=\pgfmathprintnumber@fixed@styleDEFAULT},
- set decimal separator/.initial=,
- dec sep/.style={/pgf/number format/set decimal separator={#1}},
- @dec sep mark/.initial=,
- @sci exponent mark/.initial=,
- set thousands separator/.initial=,
- 1000 sep in fractionals/.is if=pgfmathprintnumber@thousand@sep@in@fractional,
- 1000 sep in fractionals/.default=true,
- 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,
- showpos/.default=true,
- print sign/.is if=pgfmathprintnumber@showpositive,
- print sign/.default=true,
- read comma as period/.is if=pgfmathparsenumber@comma@as@period,
- read comma as period/.default=true,
- skip 0./.is if=pgfmathprintnumberskipzeroperiod,
- skip 0./.default=true,
- skip 0.= false,
- use period,
- sci 10^e/.code= {\let\pgfmathfloatrounddisplaystyle=\pgfmathfloatrounddisplaystyle@std},
- sci 10e/.code= {\let\pgfmathfloatrounddisplaystyle=\pgfmathfloatrounddisplaystyle@std},
- 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 generic/.code= {%
- \let\pgfmathfloatrounddisplaystyle=\pgfmathfloatrounddisplaystyle@generic
- \pgfkeysdefargs{/pgf/number format/sci generic/@}%
- {##1##2##3}%
- {\pgfqkeys{/pgf/number format/sci generic}{#1}}%
- },
- sci generic/mantissa sep/.initial=,%
- sci generic/empty mantissa sep/.initial=,%
- sci generic/mantisse sep/.style={/pgf/number format/sci generic/mantissa sep={#1}},%
- sci generic/empty mantisse sep/.style={/pgf/number format/sci generic/empty mantissa sep={#1}},%
- sci generic/exponent/.initial=,%
- sci generic/.value required,
- verbatim/.code={%
- \pgfqkeys{/pgf/number format}{%
- sci generic={mantissa sep=,exponent={e##1}},
- 1000 sep=,
- skip 0.=false,
- print sign=false,
- dec sep=.,
- assume math mode,
- frac TeX=\pgfmathfloatfrac@verbatim,
- frac whole format/.code={\def\pgfmathresult{##1 }},
- @dec sep mark=,
- @sci exponent mark=,
- }%
- },
- retain unit mantissa/.is if=pgfmathfloatround@allow@empty@mantissa,
- retain unit mantissa/.default=true,
- retain unit mantissa=true,
- %
- % allows to replace the implementation, for example
- % 'implementation=\num'. This is experimental -- it is inclear
- % if all consumers work well since they rely on the keys in
- % /pgf/number format.
- implementation/.code={\def\pgfmathprintnumber@protected{#1}},
+ /pgf/number format/.is family,
+ /pgf/number format,
+ fixed/.code= \pgfmath@set@number@printer{pgfmathprintnumber@FIXED},
+ sci/.code= \pgfmath@set@number@printer{pgfmathprintnumber@SCI},
+ std/.code= {\pgfmath@set@number@printer{pgfmathprintnumber@STD}\pgfmathprintnumber@STD@setparam{#1}},
+ std/.default=,%
+ relative round mode/.is choice,
+ relative round mode/fixed/.code={\def\pgfmathprintnumber@RELATIVE@choice@roundtofixed{1}},
+ relative round mode/mantissa/.code={\def\pgfmathprintnumber@RELATIVE@choice@roundtofixed{0}},
+ relative round mode/compatible/.code={\def\pgfmathprintnumber@RELATIVE@choice@roundtofixed{2}},
+ % relative={<exponent base 10>}
+ relative/.code={%
+ \pgfmath@set@number@printer{pgfmathprintnumber@RELATIVE}%
+ \pgfmathround@@orig{#1}%
+ \expandafter\pgfmathfloattoint@@\pgfmathresult\relax
+ \let\pgfmathprintnumber@RELATIVE@param=\pgfmathresult
+ },%
+ relative/.value required,
+ relative*/.style={/pgf/number format/relative={#1},/pgf/number format/relative round mode=fixed},
+ every relative/.style=std,
+ relative style/.style={/pgf/number format/every relative/.append style={#1}},
+ fixed relative/.code= \pgfmath@set@number@printer{pgfmathprintnumber@FIXED@RELATIVE},
+ int detect/.code= \pgfmath@set@number@printer{pgfmathprintnumber@INT@DETECT},
+ int trunc/.code= \pgfmath@set@number@printer{pgfmathprintnumber@INT@TRUNC},
+ frac/.code= \pgfmath@set@number@printer{pgfmathprintnumber@frac},%
+ frac TeX/.initial=\frac,
+ frac whole format/.code={\def\pgfmathresult{#1}},
+ frac denom/.initial=,
+ frac whole/.is if=pgfmathprintnumber@frac@whole,
+ frac whole=true,
+ frac shift/.initial=4,
+ frac warning/.is if=pgfmathprintnumber@frac@warn,
+ frac warning=true,
+ assume math mode/.is if=pgfmathprintnumber@assumemathmode,
+ assume math mode/.default=true,
+ fixed zerofill/.is if= pgfmathfloat@usezerofill@fixed,
+ fixed zerofill/.default=true,
+ sci zerofill/.is if= pgfmathfloat@usezerofill@sci,
+ sci zerofill/.default=true,
+ zerofill/.style= {/pgf/number format/fixed zerofill=#1,/pgf/number format/sci zerofill=#1},
+ zerofill/.default= true,
+ precision/.store in= \pgfmathfloat@round@precision,
+ sci precision/.code={%
+ \edef\pgfmathfloat@loc@TMPa{#1}%
+ \ifx\pgfmathfloat@loc@TMPa\pgfutil@empty
+ \def\pgfmathprintnumber@sci@precision{\pgfmathfloat@round@precision}%
+ \else
+ \let\pgfmathprintnumber@sci@precision=\pgfmathfloat@loc@TMPa
+ \fi
+ },%
+ sci precision/.default=,
+ sci precision=,
+ fixed default/.code= {\let\pgfmathprintnumber@fixed@style=\pgfmathprintnumber@fixed@styleDEFAULT},
+ set decimal separator/.initial=,
+ dec sep/.style={/pgf/number format/set decimal separator={#1}},
+ @dec sep mark/.initial=,
+ @sci exponent mark/.initial=,
+ set thousands separator/.initial=,
+ 1000 sep in fractionals/.is if=pgfmathprintnumber@thousand@sep@in@fractional,
+ 1000 sep in fractionals/.default=true,
+ 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,
+ showpos/.default=true,
+ print sign/.is if=pgfmathprintnumber@showpositive,
+ print sign/.default=true,
+ read comma as period/.is if=pgfmathparsenumber@comma@as@period,
+ read comma as period/.default=true,
+ skip 0./.is if=pgfmathprintnumberskipzeroperiod,
+ skip 0./.default=true,
+ skip 0.= false,
+ use period,
+ sci 10^e/.code= {\let\pgfmathfloatrounddisplaystyle=\pgfmathfloatrounddisplaystyle@std},
+ sci 10e/.code= {\let\pgfmathfloatrounddisplaystyle=\pgfmathfloatrounddisplaystyle@std},
+ 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 generic/.code= {%
+ \let\pgfmathfloatrounddisplaystyle=\pgfmathfloatrounddisplaystyle@generic
+ \pgfkeysdefargs{/pgf/number format/sci generic/@}%
+ {##1##2##3}%
+ {\pgfqkeys{/pgf/number format/sci generic}{#1}}%
+ },
+ sci generic/mantissa sep/.initial=,%
+ sci generic/empty mantissa sep/.initial=,%
+ sci generic/mantisse sep/.style={/pgf/number format/sci generic/mantissa sep={#1}},%
+ sci generic/empty mantisse sep/.style={/pgf/number format/sci generic/empty mantissa sep={#1}},%
+ sci generic/exponent/.initial=,%
+ sci generic/.value required,
+ verbatim/.code={%
+ \pgfqkeys{/pgf/number format}{%
+ sci generic={mantissa sep=,exponent={e##1}},
+ 1000 sep=,
+ skip 0.=false,
+ print sign=false,
+ dec sep=.,
+ assume math mode,
+ frac TeX=\pgfmathfloatfrac@verbatim,
+ frac whole format/.code={\def\pgfmathresult{##1 }},
+ @dec sep mark=,
+ @sci exponent mark=,
+ }%
+ },
+ retain unit mantissa/.is if=pgfmathfloatround@allow@empty@mantissa,
+ retain unit mantissa/.default=true,
+ retain unit mantissa=true,
+ %
+ % allows to replace the implementation, for example
+ % 'implementation=\num'. This is experimental -- it is unclear
+ % if all consumers work well since they rely on the keys in
+ % /pgf/number format.
+ implementation/.code={\def\pgfmathprintnumber@protected{#1}},
}
\def\pgfmathprintnumber@STD#1{%
- % parse the input:
- \pgfmathfloatparsenumber{#1}%
- \pgfmathfloat@to@FMeE@style\pgfmathresult
- \expandafter\pgfmathprintnumber@STD@issci\pgfmathresult\relax
+ % parse the input:
+ \pgfmathfloatparsenumber{#1}%
+ \pgfmathfloat@to@FMeE@style\pgfmathresult
+ \expandafter\pgfmathprintnumber@STD@issci\pgfmathresult\relax
}
\def\pgfmathprintnumber@STD@setparam#1{%
- \edef\pgfmathfloat@loc@TMPb{#1}%
- \ifx\pgfmathfloat@loc@TMPb\pgfutil@empty
- % DEFAULT for lower and upper bound.
- \def\pgfmathprintnumber@STD@getlowerbound{%
- \c@pgf@counta=\pgfmathfloat@round@precision@orig\relax
- \divide\c@pgf@counta by-2\relax
- }%
- \def\pgfmathprintnumber@STD@upperbound{4}%
- \else
- \expandafter\pgfutil@in@\expandafter:\expandafter{\pgfmathfloat@loc@TMPb}%
- \ifpgfutil@in@
- % we have -4:5 or something like that.
- % parse both values:
- \def\pgfmathfloat@loc@TMPa##1:##2\relax{%
- \edef\pgfmathprintnumber@STD@getlowerbound{%
- \noexpand\c@pgf@counta=##1\space
- }%
- \edef\pgfmathprintnumber@STD@upperbound{##2}%
- }%
- \expandafter\pgfmathfloat@loc@TMPa\pgfmathfloat@loc@TMPb\relax
- \else
- % we have just the lower bound:
- \def\pgfmathprintnumber@STD@upperbound{4}%
- \edef\pgfmathprintnumber@STD@getlowerbound{%
- \noexpand\c@pgf@counta=\pgfmathfloat@loc@TMPb\space
- }%
- \fi
- \fi
+ \edef\pgfmathfloat@loc@TMPb{#1}%
+ \ifx\pgfmathfloat@loc@TMPb\pgfutil@empty
+ % DEFAULT for lower and upper bound.
+ \def\pgfmathprintnumber@STD@getlowerbound{%
+ \c@pgf@counta=\pgfmathfloat@round@precision@orig\relax
+ \divide\c@pgf@counta by-2\relax
+ }%
+ \def\pgfmathprintnumber@STD@upperbound{4}%
+ \else
+ \expandafter\pgfutil@in@\expandafter:\expandafter{\pgfmathfloat@loc@TMPb}%
+ \ifpgfutil@in@
+ % we have -4:5 or something like that.
+ % parse both values:
+ \def\pgfmathfloat@loc@TMPa##1:##2\relax{%
+ \edef\pgfmathprintnumber@STD@getlowerbound{%
+ \noexpand\c@pgf@counta=##1\space
+ }%
+ \edef\pgfmathprintnumber@STD@upperbound{##2}%
+ }%
+ \expandafter\pgfmathfloat@loc@TMPa\pgfmathfloat@loc@TMPb\relax
+ \else
+ % we have just the lower bound:
+ \def\pgfmathprintnumber@STD@upperbound{4}%
+ \edef\pgfmathprintnumber@STD@getlowerbound{%
+ \noexpand\c@pgf@counta=\pgfmathfloat@loc@TMPb\space
+ }%
+ \fi
+ \fi
}%
\def\pgfmathprintnumber@STD@issci#1#2e#3\relax{%
- \expandafter\ifnum#1<3
- \expandafter\ifnum#3>\pgfmathprintnumber@STD@upperbound\relax
- \pgfmathprintnumber@SCI@issci#1#2e#3\relax%
- \else
- \begingroup
- \pgfmathprintnumber@STD@getlowerbound
- \ifnum#3<\c@pgf@counta
- \pgfmathprintnumber@SCI@issci#1#2e#3\relax%
- \else
- \pgfmathprintnumber@FIXED@issci#1#2e#3\relax%
- \fi
- \pgfmath@smuggleone\pgfmathresult
- \endgroup
- \fi
- \else% nan or inf:
- \pgfmathfloatrounddisplaystyle#1#2e#3\relax%
- \fi
+ \expandafter\ifnum#1<3
+ \expandafter\ifnum#3>\pgfmathprintnumber@STD@upperbound\relax
+ \pgfmathprintnumber@SCI@issci#1#2e#3\relax%
+ \else
+ \begingroup
+ \pgfmathprintnumber@STD@getlowerbound
+ \ifnum#3<\c@pgf@counta
+ \pgfmathprintnumber@SCI@issci#1#2e#3\relax%
+ \else
+ \pgfmathprintnumber@FIXED@issci#1#2e#3\relax%
+ \fi
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+ \fi
+ \else% nan or inf:
+ \pgfmathfloatrounddisplaystyle#1#2e#3\relax%
+ \fi
}
\def\pgfmathprintnumber@RELATIVE#1{%
- % parse the input:
- \pgfmathfloatparsenumber{#1}%
- \pgfmathfloat@to@FMeE@style\pgfmathresult
- \expandafter\pgfmathprintnumber@RELATIVE@issci\pgfmathresult\relax
+ % parse the input:
+ \pgfmathfloatparsenumber{#1}%
+ \pgfmathfloat@to@FMeE@style\pgfmathresult
+ \expandafter\pgfmathprintnumber@RELATIVE@issci\pgfmathresult\relax
}
\def\pgfmathprintnumber@RELATIVE@choice@roundtofixed@warn{%
- \pgf@typeout{! Package pgf warning: the use of /pgf/number format/relative is discouraged (buggy). Please use 'relative*' instead or type \string\pgfkeys{/pgf/number format/relative round mode=fixed} into your preamble.}%
- \global\let\pgfmathprintnumber@RELATIVE@choice@roundtofixed@warn=\relax
+ \pgf@typeout{! Package pgf warning: the use of /pgf/number format/relative is discouraged (buggy). Please use 'relative*' instead or type \string\pgfkeys{/pgf/number format/relative round mode=fixed} into your preamble.}%
+ \global\let\pgfmathprintnumber@RELATIVE@choice@roundtofixed@warn=\relax
}
\def\pgfmathprintnumber@RELATIVE@issci#1#2e#3\relax{%
- \begingroup
- % format X / 10^{relative}:
- \c@pgf@counta=#3\relax
- \advance\c@pgf@counta by-\pgfmathprintnumber@RELATIVE@param\relax
- \pgfmathfloatcreate{#1}{#2}{\the\c@pgf@counta}%
- % OK, round it to the desired precision:
- \if0\pgfmathprintnumber@RELATIVE@choice@roundtofixed
- % relative round mode=mantissa
- \def\b@round@fixed{0}%
- \else
- \if1\pgfmathprintnumber@RELATIVE@choice@roundtofixed
- % relative round mode=fixed
- \def\b@round@fixed{1}%
- \else
- \pgfmathprintnumber@RELATIVE@choice@roundtofixed@warn
- % relative round mode=compatible
- \ifnum\c@pgf@counta>0
- % hm. for positive exponents, we should round the
- % mantissa rather than only the fractional part.
- \def\b@round@fixed{0}%
- \else
- % negative exponent -> round fixed representation:
- \def\b@round@fixed{1}%
- \fi
- \fi
- \fi
- \if1\b@round@fixed
- % round fixed representation:
- \pgfmathfloattofixed\pgfmathresult
- \expandafter\pgfmathroundto\expandafter{\pgfmathresult}%
- \pgfmathfloatparsenumber{\pgfmathresult}%
- \pgfmathfloatroundhasperiodtrue% make sure the code below works:
- \else
- % round the mantissa:
- \expandafter\pgfmathfloatround\expandafter{\pgfmathresult}%
- \fi
- % Now, compute result * 10^{relative} and format the result:
- \pgfmathfloattoregisterstok\pgfmathresult\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
- \ifnum\pgfmathfloat@a@S=0
- \pgfmathfloat@a@E=\pgfmathfloat@a@S % avoid 0 * 10^8
- \else
- \advance\pgfmathfloat@a@E by+\pgfmathprintnumber@RELATIVE@param\relax
- \fi
- \edef\pgfmathresultX{%
- \the\pgfmathfloat@a@S
- \the\pgfmathfloat@a@Mtok
- \ifpgfmathfloatroundhasperiod\else.0\fi
- e\the\pgfmathfloat@a@E}%
- % call another formatter for the result (but avoid rounding inside of it):
- \pgfqkeys{/pgf/number format}{/pgf/number format/every relative,
- fixed zerofill=false,% useless here!
- sci zerofill=false}%
- \ifx\pgfmathprintnumber@issci\pgfmathprintnumber@RELATIVE@issci
- \pgfmath@error{The '/pgf/number format/every relative' style should set a valid display style}%
- \fi
- \let\pgfmathfloat@round@precision@orig=\pgfmathfloat@round@precision
- \def\pgfmathfloat@round@precision{9999}%
- \expandafter\pgfmathprintnumber@issci\pgfmathresultX\relax%
- \pgfmath@smuggleone\pgfmathresult
- \endgroup
+ \begingroup
+ % format X / 10^{relative}:
+ \c@pgf@counta=#3\relax
+ \advance\c@pgf@counta by-\pgfmathprintnumber@RELATIVE@param\relax
+ \pgfmathfloatcreate{#1}{#2}{\the\c@pgf@counta}%
+ % OK, round it to the desired precision:
+ \if0\pgfmathprintnumber@RELATIVE@choice@roundtofixed
+ % relative round mode=mantissa
+ \def\b@round@fixed{0}%
+ \else
+ \if1\pgfmathprintnumber@RELATIVE@choice@roundtofixed
+ % relative round mode=fixed
+ \def\b@round@fixed{1}%
+ \else
+ \pgfmathprintnumber@RELATIVE@choice@roundtofixed@warn
+ % relative round mode=compatible
+ \ifnum\c@pgf@counta>0
+ % hm. for positive exponents, we should round the
+ % mantissa rather than only the fractional part.
+ \def\b@round@fixed{0}%
+ \else
+ % negative exponent -> round fixed representation:
+ \def\b@round@fixed{1}%
+ \fi
+ \fi
+ \fi
+ \if1\b@round@fixed
+ % round fixed representation:
+ \pgfmathfloattofixed\pgfmathresult
+ \expandafter\pgfmathroundto\expandafter{\pgfmathresult}%
+ \pgfmathfloatparsenumber{\pgfmathresult}%
+ \pgfmathfloatroundhasperiodtrue% make sure the code below works:
+ \else
+ % round the mantissa:
+ \expandafter\pgfmathfloatround\expandafter{\pgfmathresult}%
+ \fi
+ % Now, compute result * 10^{relative} and format the result:
+ \pgfmathfloattoregisterstok\pgfmathresult\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
+ \ifnum\pgfmathfloat@a@S=0
+ \pgfmathfloat@a@E=\pgfmathfloat@a@S % avoid 0 * 10^8
+ \else
+ \advance\pgfmathfloat@a@E by+\pgfmathprintnumber@RELATIVE@param\relax
+ \fi
+ \edef\pgfmathresultX{%
+ \the\pgfmathfloat@a@S
+ \the\pgfmathfloat@a@Mtok
+ \ifpgfmathfloatroundhasperiod\else.0\fi
+ e\the\pgfmathfloat@a@E}%
+ % call another formatter for the result (but avoid rounding inside of it):
+ \pgfqkeys{/pgf/number format}{/pgf/number format/every relative,
+ fixed zerofill=false,% useless here!
+ sci zerofill=false}%
+ \ifx\pgfmathprintnumber@issci\pgfmathprintnumber@RELATIVE@issci
+ \pgfmath@error{The '/pgf/number format/every relative' style should set a valid display style}%
+ \fi
+ \let\pgfmathfloat@round@precision@orig=\pgfmathfloat@round@precision
+ \def\pgfmathfloat@round@precision{9999}%
+ \expandafter\pgfmathprintnumber@issci\pgfmathresultX\relax%
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
}
\def\pgfmathprintnumber@FIXED@RELATIVE#1{%
- % parse the input:
- \pgfmathfloatparsenumber{#1}%
- \pgfmathfloat@to@FMeE@style\pgfmathresult
- \expandafter\pgfmathprintnumber@FIXED@RELATIVE@issci\pgfmathresult\relax
+ % parse the input:
+ \pgfmathfloatparsenumber{#1}%
+ \pgfmathfloat@to@FMeE@style\pgfmathresult
+ \expandafter\pgfmathprintnumber@FIXED@RELATIVE@issci\pgfmathresult\relax
}
\def\pgfmathprintnumber@FIXED@RELATIVE@issci#1#2e#3\relax{%
- \begingroup
- \pgfmathfloatcreate{#1}{#2}{#3}%
- % we want the first <precision> digits - not the first
- % <precision>+1 digits:
- \c@pgf@counta=\pgfmathfloat@round@precision\relax
- \advance\c@pgf@counta by-1
- \edef\pgfmathfloat@round@precision{\the\c@pgf@counta}%
- \pgfmathfloatround{\pgfmathresult}%
- \pgfmathfloattoregisterstok\pgfmathresult\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
- \ifnum\pgfmathfloat@a@S=0
- \pgfmathfloat@a@E=\pgfmathfloat@a@S % avoid 0 * 10^8
- \fi
- \edef\pgfmathresultX{%
- \the\pgfmathfloat@a@S
- \the\pgfmathfloat@a@Mtok
- \ifpgfmathfloatroundhasperiod\else.0\fi
- e\the\pgfmathfloat@a@E}%
- \let\pgfmathfloat@round@precision@orig=\pgfmathfloat@round@precision
- \pgfmathfloat@usezerofill@fixedfalse
- \def\pgfmathfloat@round@precision{9999}% typeset all remaining digits!
- \expandafter\pgfmathprintnumber@FIXED@issci\pgfmathresultX\relax%
- \pgfmath@smuggleone\pgfmathresult
- \endgroup
+ \begingroup
+ \pgfmathfloatcreate{#1}{#2}{#3}%
+ % we want the first <precision> digits - not the first
+ % <precision>+1 digits:
+ \c@pgf@counta=\pgfmathfloat@round@precision\relax
+ \advance\c@pgf@counta by-1
+ \edef\pgfmathfloat@round@precision{\the\c@pgf@counta}%
+ \pgfmathfloatround{\pgfmathresult}%
+ \pgfmathfloattoregisterstok\pgfmathresult\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
+ \ifnum\pgfmathfloat@a@S=0
+ \pgfmathfloat@a@E=\pgfmathfloat@a@S % avoid 0 * 10^8
+ \fi
+ \edef\pgfmathresultX{%
+ \the\pgfmathfloat@a@S
+ \the\pgfmathfloat@a@Mtok
+ \ifpgfmathfloatroundhasperiod\else.0\fi
+ e\the\pgfmathfloat@a@E}%
+ \let\pgfmathfloat@round@precision@orig=\pgfmathfloat@round@precision
+ \pgfmathfloat@usezerofill@fixedfalse
+ \def\pgfmathfloat@round@precision{9999}% typeset all remaining digits!
+ \expandafter\pgfmathprintnumber@FIXED@issci\pgfmathresultX\relax%
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
}
\def\pgfmathprintnumber@frac#1{%
- % parse the input:
- \pgfmathfloatparsenumber{#1}%
- \pgfmathfloatgetfrac{\pgfmathresult}%
- \expandafter\pgfmathprintnumber@frac@formatresult\pgfmathresult
+ % parse the input:
+ \pgfmathfloatparsenumber{#1}%
+ \pgfmathfloatgetfrac{\pgfmathresult}%
+ \expandafter\pgfmathprintnumber@frac@formatresult\pgfmathresult
}
\def\pgfmathprintnumber@frac@issci#1#2e#3\relax{%
- \pgfmathfloatcreate{#1}{#2}{#3}%
- \pgfmathfloatgetfrac{\pgfmathresult}%
- \expandafter\pgfmathprintnumber@frac@formatresult\pgfmathresult
+ \pgfmathfloatcreate{#1}{#2}{#3}%
+ \pgfmathfloatgetfrac{\pgfmathresult}%
+ \expandafter\pgfmathprintnumber@frac@formatresult\pgfmathresult
}
\def\pgfmathprintnumber@frac@formatresult#1#2#3{%
- \begingroup
- \pgfkeysgetvalue{/pgf/number format/frac TeX}\pgfmathresult
- \toks0=\expandafter{\pgfmathresult}%
- \def\pgfmathfloat@loc@TMPa{#1}%
- \ifx\pgfmathfloat@loc@TMPa\pgfutil@empty
- \ifpgfmathprintnumber@showpositive
- \def\pgfmathfloat@loc@TMPa{+}%
- \fi
- \else
- \ifx\pgfmathfloat@loc@TMPa-%
- \else
- \ifx\pgfmathfloat@loc@TMPa+%
- \else
- \ifpgfmathprintnumber@showpositive
- \edef\pgfmathfloat@loc@TMPa{+\pgfmathfloat@loc@TMPa}%
- \fi
- \def\pgfmathfloat@loc@TMPb{\pgfkeysvalueof{/pgf/number format/frac whole format/.@cmd}}%
- \expandafter\pgfmathfloat@loc@TMPb\pgfmathfloat@loc@TMPa\pgfeov
- \let\pgfmathfloat@loc@TMPa=\pgfmathresult
- \fi
- \fi
- \fi
- \toks1=\expandafter{\pgfmathfloat@loc@TMPa}%
- \edef\pgfmathresult{%
- \the\toks1 \ifnum#2=0 \else\the\toks0 {#2}{#3}\fi%
- }%
- \pgfmath@smuggleone\pgfmathresult
- \endgroup
+ \begingroup
+ \pgfkeysgetvalue{/pgf/number format/frac TeX}\pgfmathresult
+ \toks0=\expandafter{\pgfmathresult}%
+ \def\pgfmathfloat@loc@TMPa{#1}%
+ \ifx\pgfmathfloat@loc@TMPa\pgfutil@empty
+ \ifpgfmathprintnumber@showpositive
+ \def\pgfmathfloat@loc@TMPa{+}%
+ \fi
+ \else
+ \ifx\pgfmathfloat@loc@TMPa-%
+ \else
+ \ifx\pgfmathfloat@loc@TMPa+%
+ \else
+ \ifpgfmathprintnumber@showpositive
+ \edef\pgfmathfloat@loc@TMPa{+\pgfmathfloat@loc@TMPa}%
+ \fi
+ \def\pgfmathfloat@loc@TMPb{\pgfkeysvalueof{/pgf/number format/frac whole format/.@cmd}}%
+ \expandafter\pgfmathfloat@loc@TMPb\pgfmathfloat@loc@TMPa\pgfeov
+ \let\pgfmathfloat@loc@TMPa=\pgfmathresult
+ \fi
+ \fi
+ \fi
+ \toks1=\expandafter{\pgfmathfloat@loc@TMPa}%
+ \edef\pgfmathresult{%
+ \the\toks1 \ifnum#2=0 \else\the\toks0 {#2}{#3}\fi%
+ }%
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
}%
% Defines \pgfmathresult to contain three sets of braces containing
@@ -1311,179 +1311,179 @@
%
% The numerator and denominator is always a number (not empty)
\def\pgfmathfloatgetfrac#1{%
- \pgfutil@ifundefined{pgfmathfloatmultiply@}{%
- \pgfmath@PackageError{Sorry, the number format 'frac' requires '\string\usetikzlibrary{fpu}' (and, optionally, \string\usepackage{fp}) in order to work correctly}%
- \edef\pgfmathresult{{#1}{0}{1}}%
- }{%
- \pgfmathfloatgetfrac@{#1}%
- }%
+ \pgfutil@ifundefined{pgfmathfloatmultiply@}{%
+ \pgfmath@PackageError{Sorry, the number format 'frac' requires '\string\usetikzlibrary{fpu}' (and, optionally, \string\usepackage{fp}) in order to work correctly}%
+ \edef\pgfmathresult{{#1}{0}{1}}%
+ }{%
+ \pgfmathfloatgetfrac@{#1}%
+ }%
}%
\def\pgfmathfloatgetfrac@#1{%
- \begingroup
- \edef\pgfmathfloat@arg{#1}%
- \expandafter\pgfmathfloat@decompose@tok\pgfmathfloat@arg\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
- \def\pgfmathfloat@loc@TMPa{0}%
- \ifcase\pgfmathfloat@a@S
- % #1 = 0:
- \def\pgfmathresult{{0}{0}{1}}%
- \or% #1 > 0
- \pgfmathfloat@a@S=1
- \def\pgfmathfloat@loc@TMPa{1}%
- \or% #1 < 0
- \pgfmathfloat@a@S=-1
- \def\pgfmathfloat@loc@TMPa{1}%
- \or
- \edef\pgfmathresult{{}{NaN}{1}}%
- \or
- \edef\pgfmathresult{{}{\infty}{1}}%
- \or
- \edef\pgfmathresult{{-}{\infty}{1}}%
- \fi
- \if1\pgfmathfloat@loc@TMPa
- \ifnum\pgfmathfloat@a@E<0
- \def\pgfmathfloat@wholenumber{}%
- \else
- \pgfmathfloatcreate{1}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}%
- \pgfmathfloattofixed\pgfmathresult%
- \def\pgfmathfloat@loc@TMPa##1.##2\relax{%
- \def\pgfmathfloat@wholenumber{##1}%
- \pgfmathfloatparsenumber{0.##2}%
- }%
- \expandafter\pgfmathfloat@loc@TMPa\pgfmathresult\relax
- \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@b@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
- \fi
- %
- \def\pgfmathfloat@loc@TMPa##1.##2\relax{%
- \def\pgfmathfloat@mantissa@first{##1}%
- \def\pgfmathfloat@mantissa@ltone{0.##2}%
- }%
- \expandafter\pgfmathfloat@loc@TMPa\the\pgfmathfloat@a@Mtok\relax
- %
- \def\pgfmathfloat@loc@@to@int##1.##2\relax##3{%
- ##3=##1
- \ifdim0.##2pt>0.5pt
- \advance##3 by1
- \fi
- }%
- %
- % alias registers names:
- \let\pgfmathresultnumerator=\pgfmathfloat@b@S
- \let\pgfmathresultdenom=\pgfmathfloat@b@E
- %
- \pgfkeysgetvalue{/pgf/number format/frac denom}\pgfmath@target@denominator
- \ifx\pgfmath@target@denominator\pgfutil@empty
- %
- \pgfmathfloat@a@E=-\pgfmathfloat@a@E
- \ifdim\pgfmathfloat@mantissa@ltone pt=0pt
- \def\pgfmathfloat@factor{1}%
- \edef\pgfmathfloat@scaled@numerator{\the\pgfmathfloat@a@Mtok}%
- \else
- % FIXME : this here is numerically instable.
- %
- % The errors of 1/r are magnified by 10^k which
- % doesn't work.
- \pgfutil@ifundefined{FPdiv}{%
- \pgfmathfloatparsenumber{\pgfmathfloat@mantissa@ltone}%
- \pgfmathfloatreciprocal@{\pgfmathresult}%
- }{%
- % \usepackage{fp}.
- % yields higher absolute precision.
- \FPmessagesfalse%
- \FPdebugfalse%
- \FPdiv\pgfmathresult{1}{\pgfmathfloat@mantissa@ltone}%
- \pgfmathfloatparsenumber{\pgfmathresult}%
- }%
- \let\pgfmathfloat@inv=\pgfmathresult
- \pgfmathfloatcreate{1}{1.0}{\pgfkeysvalueof{/pgf/number format/frac shift}}%
- \let\pgfmathfloat@scalebaseten=\pgfmathresult
- \pgfmathfloatmultiply@{\pgfmathfloat@inv}{\pgfmathfloat@scalebaseten}%
- \let\pgfmathfloat@factor=\pgfmathresult
- %
- \expandafter\pgfmathfloatparsenumber\expandafter{\the\pgfmathfloat@a@Mtok}%
- \let\pgfmathfloat@loc@TMPa=\pgfmathresult
- \pgfmathfloatmultiply@{\pgfmathfloat@factor}{\pgfmathfloat@loc@TMPa}%
- \pgfmathfloattofixed\pgfmathresult
- \let\pgfmathfloat@scaled@numerator=\pgfmathresult
- %
- \pgfmathfloattofixed\pgfmathfloat@factor
- \expandafter\pgfmathfloat@loc@@to@int\pgfmathresult\relax{\pgfmathfloat@b@S}%
- \edef\pgfmathfloat@factor{\the\pgfmathfloat@b@S}%
- \fi
- %
- %
- \pgfmathresultdenom=\pgfmathfloat@factor\relax
- \pgfmathfloat@multiply@ten@to@the@E\pgfmathresultdenom
- %
- \expandafter\pgfmathfloat@loc@@to@int\pgfmathfloat@scaled@numerator\relax{\pgfmathresultnumerator}%
- %\message{scale = \pgfmathfloat@factor; Z = \the\pgfmathresultnumerator\space ( von \pgfmathfloat@scaled@numerator), N = \the\pgfmathresultdenom.}%
- %
- \pgfmathgreatestcommondivisor{\pgfmathresultnumerator}{\pgfmathresultdenom}%
- \divide\pgfmathresultnumerator by\pgfmathresult\relax
- \divide\pgfmathresultdenom by\pgfmathresult\relax
- \ifpgfmathprintnumber@frac@warn
- \ifnum\pgfmathresultdenom>1000
- \pgfutil@ifundefined{FPdiv}{%
- \pgfmathfloattosci@\pgfmathfloat@arg
- \pgf@typeout{! Package pgf /pgf/number format/frac warning=true: /pgf/number format/frac of `\pgfmathresult' = \the\pgfmathresultnumerator\space / \the\pgfmathresultdenom\space might be large due to instabilities. Try \string\usepackage{fp} to improve accuracy.}%
- }{}%
- \fi
- \fi
- \else
- % use target denominator:
- \pgfmathresultdenom=\pgfmath@target@denominator\relax
- \pgfmathfloatcreate{1}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}%
- \pgfmathfloattofixed\pgfmathresult
- \pgf@xa=\pgfmathresult pt
- \multiply\pgf@xa by\pgfmathresultdenom
- \edef\pgfmathfloat@scaled@numerator{\pgf@sys@tonumber\pgf@xa}%
- \expandafter\pgfmathfloat@loc@@to@int\pgfmathfloat@scaled@numerator\relax{\pgfmathresultnumerator}%
- \fi
- \ifpgfmathprintnumber@frac@whole
- \else
- \ifx\pgfmathfloat@wholenumber\pgfutil@empty
- \else
- \count0=\pgfmathfloat@wholenumber\relax
- \multiply\count0 by\pgfmathresultdenom
- \advance\pgfmathresultnumerator by\count0
- \def\pgfmathfloat@wholenumber{}%
- \fi
- \fi
- \ifnum\pgfmathfloat@a@S<0
- \edef\pgfmathresult{{-\pgfmathfloat@wholenumber}{\the\pgfmathresultnumerator}{\the\pgfmathresultdenom}}%
- \else
- \edef\pgfmathresult{{\pgfmathfloat@wholenumber}{\the\pgfmathresultnumerator}{\the\pgfmathresultdenom}}%
- \fi
- \fi
- \pgfmath@smuggleone\pgfmathresult
- \endgroup
+ \begingroup
+ \edef\pgfmathfloat@arg{#1}%
+ \expandafter\pgfmathfloat@decompose@tok\pgfmathfloat@arg\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
+ \def\pgfmathfloat@loc@TMPa{0}%
+ \ifcase\pgfmathfloat@a@S
+ % #1 = 0:
+ \def\pgfmathresult{{0}{0}{1}}%
+ \or% #1 > 0
+ \pgfmathfloat@a@S=1
+ \def\pgfmathfloat@loc@TMPa{1}%
+ \or% #1 < 0
+ \pgfmathfloat@a@S=-1
+ \def\pgfmathfloat@loc@TMPa{1}%
+ \or
+ \edef\pgfmathresult{{}{NaN}{1}}%
+ \or
+ \edef\pgfmathresult{{}{\infty}{1}}%
+ \or
+ \edef\pgfmathresult{{-}{\infty}{1}}%
+ \fi
+ \if1\pgfmathfloat@loc@TMPa
+ \ifnum\pgfmathfloat@a@E<0
+ \def\pgfmathfloat@wholenumber{}%
+ \else
+ \pgfmathfloatcreate{1}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}%
+ \pgfmathfloattofixed\pgfmathresult%
+ \def\pgfmathfloat@loc@TMPa##1.##2\relax{%
+ \def\pgfmathfloat@wholenumber{##1}%
+ \pgfmathfloatparsenumber{0.##2}%
+ }%
+ \expandafter\pgfmathfloat@loc@TMPa\pgfmathresult\relax
+ \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@b@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
+ \fi
+ %
+ \def\pgfmathfloat@loc@TMPa##1.##2\relax{%
+ \def\pgfmathfloat@mantissa@first{##1}%
+ \def\pgfmathfloat@mantissa@ltone{0.##2}%
+ }%
+ \expandafter\pgfmathfloat@loc@TMPa\the\pgfmathfloat@a@Mtok\relax
+ %
+ \def\pgfmathfloat@loc@@to@int##1.##2\relax##3{%
+ ##3=##1
+ \ifdim0.##2pt>0.5pt
+ \advance##3 by1
+ \fi
+ }%
+ %
+ % alias registers names:
+ \let\pgfmathresultnumerator=\pgfmathfloat@b@S
+ \let\pgfmathresultdenom=\pgfmathfloat@b@E
+ %
+ \pgfkeysgetvalue{/pgf/number format/frac denom}\pgfmath@target@denominator
+ \ifx\pgfmath@target@denominator\pgfutil@empty
+ %
+ \pgfmathfloat@a@E=-\pgfmathfloat@a@E
+ \ifdim\pgfmathfloat@mantissa@ltone pt=0pt
+ \def\pgfmathfloat@factor{1}%
+ \edef\pgfmathfloat@scaled@numerator{\the\pgfmathfloat@a@Mtok}%
+ \else
+ % FIXME : this here is numerically instable.
+ %
+ % The errors of 1/r are magnified by 10^k which
+ % doesn't work.
+ \pgfutil@ifundefined{FPdiv}{%
+ \pgfmathfloatparsenumber{\pgfmathfloat@mantissa@ltone}%
+ \pgfmathfloatreciprocal@{\pgfmathresult}%
+ }{%
+ % \usepackage{fp}.
+ % yields higher absolute precision.
+ \FPmessagesfalse%
+ \FPdebugfalse%
+ \FPdiv\pgfmathresult{1}{\pgfmathfloat@mantissa@ltone}%
+ \pgfmathfloatparsenumber{\pgfmathresult}%
+ }%
+ \let\pgfmathfloat@inv=\pgfmathresult
+ \pgfmathfloatcreate{1}{1.0}{\pgfkeysvalueof{/pgf/number format/frac shift}}%
+ \let\pgfmathfloat@scalebaseten=\pgfmathresult
+ \pgfmathfloatmultiply@{\pgfmathfloat@inv}{\pgfmathfloat@scalebaseten}%
+ \let\pgfmathfloat@factor=\pgfmathresult
+ %
+ \expandafter\pgfmathfloatparsenumber\expandafter{\the\pgfmathfloat@a@Mtok}%
+ \let\pgfmathfloat@loc@TMPa=\pgfmathresult
+ \pgfmathfloatmultiply@{\pgfmathfloat@factor}{\pgfmathfloat@loc@TMPa}%
+ \pgfmathfloattofixed\pgfmathresult
+ \let\pgfmathfloat@scaled@numerator=\pgfmathresult
+ %
+ \pgfmathfloattofixed\pgfmathfloat@factor
+ \expandafter\pgfmathfloat@loc@@to@int\pgfmathresult\relax{\pgfmathfloat@b@S}%
+ \edef\pgfmathfloat@factor{\the\pgfmathfloat@b@S}%
+ \fi
+ %
+ %
+ \pgfmathresultdenom=\pgfmathfloat@factor\relax
+ \pgfmathfloat@multiply@ten@to@the@E\pgfmathresultdenom
+ %
+ \expandafter\pgfmathfloat@loc@@to@int\pgfmathfloat@scaled@numerator\relax{\pgfmathresultnumerator}%
+ %\message{scale = \pgfmathfloat@factor; Z = \the\pgfmathresultnumerator\space ( von \pgfmathfloat@scaled@numerator), N = \the\pgfmathresultdenom.}%
+ %
+ \pgfmathgreatestcommondivisor{\pgfmathresultnumerator}{\pgfmathresultdenom}%
+ \divide\pgfmathresultnumerator by\pgfmathresult\relax
+ \divide\pgfmathresultdenom by\pgfmathresult\relax
+ \ifpgfmathprintnumber@frac@warn
+ \ifnum\pgfmathresultdenom>1000
+ \pgfutil@ifundefined{FPdiv}{%
+ \pgfmathfloattosci@\pgfmathfloat@arg
+ \pgf@typeout{! Package pgf /pgf/number format/frac warning=true: /pgf/number format/frac of `\pgfmathresult' = \the\pgfmathresultnumerator\space / \the\pgfmathresultdenom\space might be large due to instabilities. Try \string\usepackage{fp} to improve accuracy.}%
+ }{}%
+ \fi
+ \fi
+ \else
+ % use target denominator:
+ \pgfmathresultdenom=\pgfmath@target@denominator\relax
+ \pgfmathfloatcreate{1}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}%
+ \pgfmathfloattofixed\pgfmathresult
+ \pgf@xa=\pgfmathresult pt
+ \multiply\pgf@xa by\pgfmathresultdenom
+ \edef\pgfmathfloat@scaled@numerator{\pgf@sys@tonumber\pgf@xa}%
+ \expandafter\pgfmathfloat@loc@@to@int\pgfmathfloat@scaled@numerator\relax{\pgfmathresultnumerator}%
+ \fi
+ \ifpgfmathprintnumber@frac@whole
+ \else
+ \ifx\pgfmathfloat@wholenumber\pgfutil@empty
+ \else
+ \count0=\pgfmathfloat@wholenumber\relax
+ \multiply\count0 by\pgfmathresultdenom
+ \advance\pgfmathresultnumerator by\count0
+ \def\pgfmathfloat@wholenumber{}%
+ \fi
+ \fi
+ \ifnum\pgfmathfloat@a@S<0
+ \edef\pgfmathresult{{-\pgfmathfloat@wholenumber}{\the\pgfmathresultnumerator}{\the\pgfmathresultdenom}}%
+ \else
+ \edef\pgfmathresult{{\pgfmathfloat@wholenumber}{\the\pgfmathresultnumerator}{\the\pgfmathresultdenom}}%
+ \fi
+ \fi
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
}%
\def\pgfmathfloat@gobble@until@relax#1\relax{}
% computes the greatest common divisor of two integer numbers (in
% integer arithmetics).
\def\pgfmathgreatestcommondivisor#1#2{%
- \begingroup
- \count0=#1\relax
- \count1=#2\relax
- \ifnum\count0=0
- \edef\pgfmathresult{\the\count1}%
- \else
- \pgfmathgreatestcommondivisor@loop
- \edef\pgfmathresult{\the\count0}%
- \fi
- \pgfmath@smuggleone\pgfmathresult
- \endgroup
+ \begingroup
+ \count0=#1\relax
+ \count1=#2\relax
+ \ifnum\count0=0
+ \edef\pgfmathresult{\the\count1}%
+ \else
+ \pgfmathgreatestcommondivisor@loop
+ \edef\pgfmathresult{\the\count0}%
+ \fi
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
}
\def\pgfmathgreatestcommondivisor@loop{%
- \ifnum\count1=0
- \else
- \ifnum\count0>\count1
- \advance\count0 by-\count1
- \else
- \advance\count1 by-\count0
- \fi
- \expandafter\pgfmathgreatestcommondivisor@loop
- \fi
+ \ifnum\count1=0
+ \else
+ \ifnum\count0>\count1
+ \advance\count0 by-\count1
+ \else
+ \advance\count1 by-\count0
+ \fi
+ \expandafter\pgfmathgreatestcommondivisor@loop
+ \fi
}%
% multiplies a TeX register by 10^E where E is stored in the register
@@ -1491,146 +1491,146 @@
%
% #1 a TeX register
\def\pgfmathfloat@multiply@ten@to@the@E#1{%
- \ifnum\pgfmathfloat@a@E>0
- \multiply#1 by10
- \advance\pgfmathfloat@a@E by-1
- \def\pgfmathfloat@multiply@ten@to@the@E@next{\pgfmathfloat@multiply@ten@to@the@E{#1}}%
- \else
- \let\pgfmathfloat@multiply@ten@to@the@E@next=\relax%
- \fi
- \pgfmathfloat@multiply@ten@to@the@E@next
+ \ifnum\pgfmathfloat@a@E>0
+ \multiply#1 by10
+ \advance\pgfmathfloat@a@E by-1
+ \def\pgfmathfloat@multiply@ten@to@the@E@next{\pgfmathfloat@multiply@ten@to@the@E{#1}}%
+ \else
+ \let\pgfmathfloat@multiply@ten@to@the@E@next=\relax%
+ \fi
+ \pgfmathfloat@multiply@ten@to@the@E@next
}%
\def\pgfmathprintnumber@INT@TRUNC#1{%
- \pgfmathfloatparsenumber{#1}%
- \pgfmathfloat@to@FMeE@style\pgfmathresult
- \expandafter\pgfmathprintnumber@INT@TRUNC@issci\pgfmathresult\relax
+ \pgfmathfloatparsenumber{#1}%
+ \pgfmathfloat@to@FMeE@style\pgfmathresult
+ \expandafter\pgfmathprintnumber@INT@TRUNC@issci\pgfmathresult\relax
}
\def\pgfmathprintnumber@INT@TRUNC@impl#1.#2\relax#3#4e#5\relax{%
- \pgfmathfloatroundhasperiodfalse
- \pgfmathprintnumber@fixed@style{#1}#3#4e#5\relax%
+ \pgfmathfloatroundhasperiodfalse
+ \pgfmathprintnumber@fixed@style{#1}#3#4e#5\relax%
}
\def\pgfmathprintnumber@INT@TRUNC@issci#1#2e#3\relax{%
- \ifnum#1<3\relax
- \pgfmathfloatcreate{#1}{#2}{#3}%
- \pgfmathfloattofixed{\pgfmathresult}%
- \expandafter\pgfmathprintnumber@INT@TRUNC@impl\pgfmathresult\relax#1#2e#3\relax
- \else
- \pgfmathfloatrounddisplaystyle#1#2e#3\relax%
- \fi
+ \ifnum#1<3\relax
+ \pgfmathfloatcreate{#1}{#2}{#3}%
+ \pgfmathfloattofixed{\pgfmathresult}%
+ \expandafter\pgfmathprintnumber@INT@TRUNC@impl\pgfmathresult\relax#1#2e#3\relax
+ \else
+ \pgfmathfloatrounddisplaystyle#1#2e#3\relax%
+ \fi
}
% Invokes '#2' if '#1' is actually an integer or '#3' if not.
%
-% As a side--effect, \pgfretval will be set to the integer value if it
+% As a side-effect, \pgfretval will be set to the integer value if it
% actually *is* an integer. Otherwise, \pgfretval will contain the
% parsed floating point number.
%
% #1 a number constant (not necessarily a parsed float).
\def\pgfmathifisint#1#2#3{%
- \gdef\pgfmathfloatisint@@{0}%
- \begingroup
- \pgfmathfloatparsenumber{#1}%
- \let\pgfretval\pgfmathresult
- \pgfmathfloat@to@FMeE@style\pgfmathresult
- \expandafter\pgfmathfloatisint@\pgfmathresult\relax
- \pgfmath@smuggleone\pgfretval
- \endgroup
- \if1\pgfmathfloatisint@@ #2\else #3\fi
+ \gdef\pgfmathfloatisint@@{0}%
+ \begingroup
+ \pgfmathfloatparsenumber{#1}%
+ \let\pgfretval\pgfmathresult
+ \pgfmathfloat@to@FMeE@style\pgfmathresult
+ \expandafter\pgfmathfloatisint@\pgfmathresult\relax
+ \pgfmath@smuggleone\pgfretval
+ \endgroup
+ \if1\pgfmathfloatisint@@ #2\else #3\fi
}%
\def\pgfmathfloatisint@#1#2e#3\relax{%
- \ifnum#1<3\relax
- \pgfmathfloatcreate{#1}{#2}{#3}%
- \pgfmathfloattofixed{\pgfmathresult}%
- \def\pgfmathfloat@round@precision{6}%
- \expandafter\pgfmathroundto\expandafter{\pgfmathresult}%
- \ifpgfmathfloatroundhasperiod
- \else
- \let\pgfretval\pgfmathresult%
- \gdef\pgfmathfloatisint@@{1}%
- \fi
- \fi
+ \ifnum#1<3\relax
+ \pgfmathfloatcreate{#1}{#2}{#3}%
+ \pgfmathfloattofixed{\pgfmathresult}%
+ \def\pgfmathfloat@round@precision{6}%
+ \expandafter\pgfmathroundto\expandafter{\pgfmathresult}%
+ \ifpgfmathfloatroundhasperiod
+ \else
+ \let\pgfretval\pgfmathresult%
+ \gdef\pgfmathfloatisint@@{1}%
+ \fi
+ \fi
}
\def\pgfmathprintnumber@INT@DETECT#1{%
- \pgfmathfloatparsenumber{#1}%
- \pgfmathfloat@to@FMeE@style\pgfmathresult
- \expandafter\pgfmathprintnumber@INT@DETECT@issci\pgfmathresult\relax
+ \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
- \pgfmathfloatcreate{#1}{#2}{#3}%
- \pgfmathfloattofixed{\pgfmathresult}%
- \let\pgfmathfloat@round@precision@=\pgfmathfloat@round@precision
- \def\pgfmathfloat@round@precision{6}%
- \expandafter\pgfmathroundto\expandafter{\pgfmathresult}%
- \let\pgfmathfloat@round@precision=\pgfmathfloat@round@precision@
- \ifpgfmathfloatroundhasperiod
- \pgfmathprintnumber@SCI@issci#1#2e#3\relax
- \else
- \expandafter\pgfmathprintnumber@fixed@style\expandafter{\pgfmathresult}#1#2e#3\relax
- \fi
- \else
- \pgfmathfloatrounddisplaystyle#1#2e#3\relax%
- \fi
- \pgfmath@smuggleone\pgfmathresult
- \endgroup
+ \begingroup
+ \ifnum#1<3\relax
+ \pgfmathfloatcreate{#1}{#2}{#3}%
+ \pgfmathfloattofixed{\pgfmathresult}%
+ \let\pgfmathfloat@round@precision@=\pgfmathfloat@round@precision
+ \def\pgfmathfloat@round@precision{6}%
+ \expandafter\pgfmathroundto\expandafter{\pgfmathresult}%
+ \let\pgfmathfloat@round@precision=\pgfmathfloat@round@precision@
+ \ifpgfmathfloatroundhasperiod
+ \pgfmathprintnumber@SCI@issci#1#2e#3\relax
+ \else
+ \expandafter\pgfmathprintnumber@fixed@style\expandafter{\pgfmathresult}#1#2e#3\relax
+ \fi
+ \else
+ \pgfmathfloatrounddisplaystyle#1#2e#3\relax%
+ \fi
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
}
\def\pgfmathprintnumber@FIXED#1{%
- \pgfmathfloatparsenumber{#1}%
- \pgfmathfloat@to@FMeE@style\pgfmathresult
- \expandafter\pgfmathprintnumber@FIXED@issci\pgfmathresult\relax
+ \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
- \pgfmathfloatcreate{#1}{#2}{#3}%
- \pgfmathfloattofixed{\pgfmathresult}%
- \ifpgfmathfloat@usezerofill@fixed
- \expandafter\pgfmathroundtozerofill\expandafter{\pgfmathresult}%
- \else
- \expandafter\pgfmathroundto\expandafter{\pgfmathresult}%
- \fi
- \ifpgfmathfloatroundmayneedrenormalize
- \pgfmathfloat@a@E=#3\relax
- \advance\pgfmathfloat@a@E by1
- \edef\pgfmathfloat@loc@TMPb{\noexpand\pgfmathprintnumber@fixed@style{\pgfmathresult}#1#2e\the\pgfmathfloat@a@E}%
- \pgfmathfloat@loc@TMPb\relax%
- \else
- \expandafter\pgfmathprintnumber@fixed@style\expandafter{\pgfmathresult}#1#2e#3\relax%
- \fi
- \else% nan or inf:
- \pgfmathfloatrounddisplaystyle#1#2e#3\relax%
- \fi
- \pgfmath@smuggleone\pgfmathresult
- \endgroup
+ \begingroup
+ \ifnum#1<3
+ \pgfmathfloatcreate{#1}{#2}{#3}%
+ \pgfmathfloattofixed{\pgfmathresult}%
+ \ifpgfmathfloat@usezerofill@fixed
+ \expandafter\pgfmathroundtozerofill\expandafter{\pgfmathresult}%
+ \else
+ \expandafter\pgfmathroundto\expandafter{\pgfmathresult}%
+ \fi
+ \ifpgfmathfloatroundmayneedrenormalize
+ \pgfmathfloat@a@E=#3\relax
+ \advance\pgfmathfloat@a@E by1
+ \edef\pgfmathfloat@loc@TMPb{\noexpand\pgfmathprintnumber@fixed@style{\pgfmathresult}#1#2e\the\pgfmathfloat@a@E}%
+ \pgfmathfloat@loc@TMPb\relax%
+ \else
+ \expandafter\pgfmathprintnumber@fixed@style\expandafter{\pgfmathresult}#1#2e#3\relax%
+ \fi
+ \else% nan or inf:
+ \pgfmathfloatrounddisplaystyle#1#2e#3\relax%
+ \fi
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
}
\def\pgfmathprintnumber@SCI#1{%
- \pgfmathfloatparsenumber{#1}%
- \pgfmathfloat@to@FMeE@style\pgfmathresult
- \expandafter\pgfmathprintnumber@SCI@issci\pgfmathresult\relax
+ \pgfmathfloatparsenumber{#1}%
+ \pgfmathfloat@to@FMeE@style\pgfmathresult
+ \expandafter\pgfmathprintnumber@SCI@issci\pgfmathresult\relax
}
\def\pgfmathprintnumber@SCI@issci#1#2e#3\relax{%
- \begingroup
- \pgfmathfloatcreate{#1}{#2}{#3}%
- \edef\pgfmathfloat@round@precision{\pgfmathprintnumber@sci@precision}%
- \ifpgfmathfloat@usezerofill@sci
- \pgfmathfloatroundzerofill{\pgfmathresult}%
- \else
- \pgfmathfloatround{\pgfmathresult}%
- \fi
- \pgfmathfloat@to@FMeE@style\pgfmathresult
- \expandafter\pgfmathfloatrounddisplaystyle\pgfmathresult\relax
- \pgfmath@smuggleone\pgfmathresult
- \endgroup
+ \begingroup
+ \pgfmathfloatcreate{#1}{#2}{#3}%
+ \edef\pgfmathfloat@round@precision{\pgfmathprintnumber@sci@precision}%
+ \ifpgfmathfloat@usezerofill@sci
+ \pgfmathfloatroundzerofill{\pgfmathresult}%
+ \else
+ \pgfmathfloatround{\pgfmathresult}%
+ \fi
+ \pgfmathfloat@to@FMeE@style\pgfmathresult
+ \expandafter\pgfmathfloatrounddisplaystyle\pgfmathresult\relax
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
}
% Prints argument #1 using the current pretty printer environment (all
@@ -1638,89 +1638,89 @@
%
% You may specify optional arguments with \pgfmathprintnumber[...].
\def\pgfmathprintnumber{%
- % \protect allows to supply \pgfmathprintnumber inside of latex
- % captions. The \csname yields \relax in case protect is undefined.
- \pgf@texdist@protect\pgfmathprintnumber@protected
+ % \protect allows to supply \pgfmathprintnumber inside of latex
+ % captions. The \csname yields \relax in case protect is undefined.
+ \pgf@texdist@protect\pgfmathprintnumber@protected
}%
\def\pgfmathprintnumber@protected{%
- \pgfutil@ifnextchar[%
- {\pgfmathprintnumber@OPT}%
- {\pgfmathprintnumber@noopt}%
+ \pgfutil@ifnextchar[%
+ {\pgfmathprintnumber@OPT}%
+ {\pgfmathprintnumber@noopt}%
}
\def\pgfmathprintnumber@noopt#1{%
- \pgfmathprintnumber@{#1}%
- \ifpgfmathprintnumber@assumemathmode
- \pgfmathresult
- \else
- \pgfutilensuremath{\pgfmathresult}%
- \fi
+ \pgfmathprintnumber@{#1}%
+ \ifpgfmathprintnumber@assumemathmode
+ \pgfmathresult
+ \else
+ \pgfutilensuremath{\pgfmathresult}%
+ \fi
}%
\def\pgfmathprintnumber@OPT[#1]#2{%
- \begingroup
- \pgfqkeys{/pgf/number format}{#1}%
- \pgfmathprintnumber@{#2}%
- \ifpgfmathprintnumber@assumemathmode
- \pgfmathresult
- \else
- \pgfutilensuremath{\pgfmathresult}%
- \fi
- \endgroup
+ \begingroup
+ \pgfqkeys{/pgf/number format}{#1}%
+ \pgfmathprintnumber@{#2}%
+ \ifpgfmathprintnumber@assumemathmode
+ \pgfmathresult
+ \else
+ \pgfutilensuremath{\pgfmathresult}%
+ \fi
+ \endgroup
}%
% As \pgfmathprintnumber, but it produces its output into the second
% argument.
\def\pgfmathprintnumberto{%
- \pgfutil@ifnextchar[%
- {\pgfmathprintnumberto@OPT}%
- {\pgfmathprintnumberto@noopt}%
+ \pgfutil@ifnextchar[%
+ {\pgfmathprintnumberto@OPT}%
+ {\pgfmathprintnumberto@noopt}%
}
\def\pgfmathprintnumberto@noopt#1#2{%
- \begingroup
- \pgfmathprintnumber@{#1}%
- \ifpgfmathprintnumber@assumemathmode
- \global\let\pgfmathfloat@glob@TMP=\pgfmathresult
- \else
- \toks0=\expandafter{\pgfmathresult}%
- \xdef\pgfmathfloat@glob@TMP{\noexpand\pgfutilensuremath{\the\toks0 }}%
- \fi
- \endgroup
- \let#2=\pgfmathfloat@glob@TMP
+ \begingroup
+ \pgfmathprintnumber@{#1}%
+ \ifpgfmathprintnumber@assumemathmode
+ \global\let\pgfmathfloat@glob@TMP=\pgfmathresult
+ \else
+ \toks0=\expandafter{\pgfmathresult}%
+ \xdef\pgfmathfloat@glob@TMP{\noexpand\pgfutilensuremath{\the\toks0 }}%
+ \fi
+ \endgroup
+ \let#2=\pgfmathfloat@glob@TMP
}%
\def\pgfmathprintnumberto@OPT[#1]#2#3{%
- \begingroup
- \pgfqkeys{/pgf/number format}{#1}%
- \pgfmathprintnumber@{#2}%
- \ifpgfmathprintnumber@assumemathmode
- \global\let\pgfmathfloat@glob@TMP=\pgfmathresult
- \else
- \toks0=\expandafter{\pgfmathresult}%
- \xdef\pgfmathfloat@glob@TMP{\noexpand\pgfutilensuremath{\the\toks0 }}%
- \fi
- \endgroup
- \let#3=\pgfmathfloat@glob@TMP
+ \begingroup
+ \pgfqkeys{/pgf/number format}{#1}%
+ \pgfmathprintnumber@{#2}%
+ \ifpgfmathprintnumber@assumemathmode
+ \global\let\pgfmathfloat@glob@TMP=\pgfmathresult
+ \else
+ \toks0=\expandafter{\pgfmathresult}%
+ \xdef\pgfmathfloat@glob@TMP{\noexpand\pgfutilensuremath{\the\toks0 }}%
+ \fi
+ \endgroup
+ \let#3=\pgfmathfloat@glob@TMP
}%
-
+
% Changes the current number pretty printer to #1.
%
% #1 is the macro base name for the pretty print routine, without the
% leading '\'.
\def\pgfmath@set@number@printer#1{%
- \expandafter\let\expandafter\pgfmathprintnumber@\csname #1\endcsname
- \expandafter\let\expandafter\pgfmathprintnumber@issci\csname #1@issci\endcsname
+ \expandafter\let\expandafter\pgfmathprintnumber@\csname #1\endcsname
+ \expandafter\let\expandafter\pgfmathprintnumber@issci\csname #1@issci\endcsname
}
\pgfkeys{/pgf/number format/std}
%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
+%
% IMPL
%
%%%%%%%%%%%%%%%%%%%%%%%%%%
-% equals only itsself when compared with \ifx:
+% equals only itself when compared with \ifx:
\def\pgfmathfloat@EOI{\pgfmathfloat@EOI}%
% Re-use counters internally.
@@ -1734,34 +1734,33 @@
\newif\ifpgfmathround@impl@PREPERIOD@is@negative@zero
% PRECONDITION:
-% \ifpgfmathfloatroundhasperiod=\iftrue holds outside of the
-% current TeX group.
+% \ifpgfmathfloatroundhasperiod=\iftrue holds outside of the current TeX group.
%
% POSTCONDITION:
% \ifpgfmathfloatroundhasperiod will be set correctly AFTER the
% 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
- \expandafter\c@pgfmathroundto@prec\pgfmathfloat@round@precision\relax
- \c@pgfmathroundto@lastzeros=0
- \c@pgfmathroundto@offsetbehindperiod=-1 % means: no period found so far
- \pgfmathround@impl@PREPERIOD@is@negative@zerotrue
- \expandafter\pgfmathroundto@impl@ITERATE@NODOT@firstcall\pgfmathround@input\pgfmathfloat@EOI
+ \edef\pgfmathround@input{#1}%
+ \global\pgfmathfloatroundmayneedrenormalizefalse
+ \pgfmathfloat@tmptoks={}%
+ \let\pgfmathround@next=\pgfutil@empty
+ \let\pgfmathround@cur=\pgfutil@empty
+ \let\pgfmathresult=\pgfutil@empty
+ \expandafter\c@pgfmathroundto@prec\pgfmathfloat@round@precision\relax
+ \c@pgfmathroundto@lastzeros=0
+ \c@pgfmathroundto@offsetbehindperiod=-1 % means: no period found so far
+ \pgfmathround@impl@PREPERIOD@is@negative@zerotrue
+ \expandafter\pgfmathroundto@impl@ITERATE@NODOT@firstcall\pgfmathround@input\pgfmathfloat@EOI
}
% \pgfmathroundto implementation in WORDS:
%
-% coarse idea:
-% 1. collect all digits/sign BEFORE the first period in REVERSE order
-% 2. then, collect UP TO \prec digits after the period in REVERSE order
+% coarse idea:
+% 1. collect all digits/sign BEFORE the first period in REVERSE order
+% 2. then, collect UP TO \prec digits after the period in REVERSE order
% Steps 1. and 2. lead to the digit [sign] sequence
-% "x_{-p} x_{-p+1} ... x_{-2} x_{-1} '.' x_0 ... x_r"
+% "x_{-p} x_{-p+1} ... x_{-2} x_{-1} '.' x_0 ... x_r"
% where 'r' is the total number of digits. The integer 'p' denotes the
% ACTUALLY collected number of digits behind the period.
%
@@ -1774,31 +1773,31 @@
% 2. The case with p=k and x_{-p-1} is a further, next character.
%
% Then, for case 1.):
-% discard any unused zeros at the tail of our number (possibly
-% including the period)
+% discard any unused zeros at the tail of our number (possibly
+% including the period)
%
% and in case 2.)
% if NEXT DIGIT < 5:
% do exactly the same as in case 1.) above and discard any
% following digits.
% else
-% let q := -p
-% while(x_q = 9 and q<=r )
-% if q>=0
-% set x_q = '0'
-% else
-% discard digit x_q='9'
-% fi
-% ++q
-% if q=0
-% discard the period
-% fi
-% end while
-% if q = r+1
-% insert a '1'
-% else
-% set x_q = x_q + 1
-% fi
+% let q := -p
+% while(x_q = 9 and q<=r )
+% if q>=0
+% set x_q = '0'
+% else
+% discard digit x_q='9'
+% fi
+% ++q
+% if q=0
+% discard the period
+% fi
+% end while
+% if q = r+1
+% insert a '1'
+% else
+% set x_q = x_q + 1
+% fi
% fi
%
% All these loops have been implemented in spaghetti-code below.
@@ -1807,22 +1806,22 @@
% counting logic).
%
% Some comments:
-% - The token register \pgfmathfloat@tmptoks is used to accumulate the REVERSED input number.
-% - \pgfmathfloat@EOI always denotes 'END OF INPUT'.
-% - in the second stage, we need to reverse \pgfmathfloat@tmptoks.
-% This is -again- done with \pgfmathfloat@tmptoks.
+% - The token register \pgfmathfloat@tmptoks is used to accumulate the REVERSED input number.
+% - \pgfmathfloat@EOI always denotes 'END OF INPUT'.
+% - in the second stage, we need to reverse \pgfmathfloat@tmptoks.
+% This is -- again -- done with \pgfmathfloat@tmptoks.
\def\pgfmathroundto@impl@discard@period#1.#2\pgfmathfloat@EOI{%
- \pgfmathfloatroundhasperiodfalse
- \aftergroup\pgfmathfloatroundhasperiodfalse
- \def\pgfmathresult{#1}%
+ \pgfmathfloatroundhasperiodfalse
+ \aftergroup\pgfmathfloatroundhasperiodfalse
+ \def\pgfmathresult{#1}%
}
\def\pgfmathroundto@impl@gobble@rest@and@start#1\pgfmathfloat@EOI{%
- \pgfmathroundto@impl@start
+ \pgfmathroundto@impl@start
}
\def\pgfmathroundto@impl@gobble@and@start\pgfmathfloat@EOI{%
- \pgfmathroundto@impl@start
+ \pgfmathroundto@impl@start
}
\def\pgfmathroundto@impl@gobble\pgfmathfloat@EOI{}%
\def\pgfmathroundto@impl@gobble@rest#1\pgfmathfloat@EOI{}%
@@ -1830,281 +1829,281 @@
% This method will be invoked as soon as the first step, the reverse
% collection of up to PREC digits after the period, has finished.
\def\pgfmathroundto@impl@start{%
- \ifx\pgfmathround@next\pgfutil@empty
- \ifnum\c@pgfmathroundto@offsetbehindperiod<0
- % no period found.
- \ifpgfmathfloat@fixed@digits@after@period
- \ifnum\c@pgfmathroundto@prec=0\relax
- \pgfmathfloatroundhasperiodfalse
- \aftergroup\pgfmathfloatroundhasperiodfalse
- \edef\pgfmathresult{\pgfmathround@input}%
- \else
- \pgfmathfloat@tmptoks=\expandafter{\pgfmathround@input.}%
- \c@pgfmathroundto@offsetbehindperiod=\c@pgfmathroundto@prec
- \pgfmathroundto@impl@append@zeros
- \edef\pgfmathresult{\the\pgfmathfloat@tmptoks}%
- \fi
- \else
- \pgfmathfloatroundhasperiodfalse
- \aftergroup\pgfmathfloatroundhasperiodfalse
- \edef\pgfmathresult{\pgfmathround@input}%
- \fi
- \else
- %\ifnum\c@pgfmathroundto@offsetbehindperiod>\c@pgfmathroundto@prec
- % \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}{}%
- %\fi
- \expandafter\ifnum\pgfmathround@next<5\relax
- \pgfmathroundto@impl@finish@with@truncation
- \else
- \multiply\c@pgfmathroundto@offsetbehindperiod by-1
- \expandafter\pgfmathroundto@impl@ADD@ONE\the\pgfmathfloat@tmptoks\pgfmathfloat@EOI
- \fi
- \fi
-}
-
+ \ifx\pgfmathround@next\pgfutil@empty
+ \ifnum\c@pgfmathroundto@offsetbehindperiod<0
+ % no period found.
+ \ifpgfmathfloat@fixed@digits@after@period
+ \ifnum\c@pgfmathroundto@prec=0\relax
+ \pgfmathfloatroundhasperiodfalse
+ \aftergroup\pgfmathfloatroundhasperiodfalse
+ \edef\pgfmathresult{\pgfmathround@input}%
+ \else
+ \pgfmathfloat@tmptoks=\expandafter{\pgfmathround@input.}%
+ \c@pgfmathroundto@offsetbehindperiod=\c@pgfmathroundto@prec
+ \pgfmathroundto@impl@append@zeros
+ \edef\pgfmathresult{\the\pgfmathfloat@tmptoks}%
+ \fi
+ \else
+ \pgfmathfloatroundhasperiodfalse
+ \aftergroup\pgfmathfloatroundhasperiodfalse
+ \edef\pgfmathresult{\pgfmathround@input}%
+ \fi
+ \else
+ %\ifnum\c@pgfmathroundto@offsetbehindperiod>\c@pgfmathroundto@prec
+ % \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}{}%
+ %\fi
+ \expandafter\ifnum\pgfmathround@next<5\relax
+ \pgfmathroundto@impl@finish@with@truncation
+ \else
+ \multiply\c@pgfmathroundto@offsetbehindperiod by-1
+ \expandafter\pgfmathroundto@impl@ADD@ONE\the\pgfmathfloat@tmptoks\pgfmathfloat@EOI
+ \fi
+ \fi
+}
+
% takes the current input and decides whether trailing zeros shall be
% discarded or more zeros need to be filled in.
\def\pgfmathroundto@impl@finish@with@truncation{%
- \ifpgfmathfloat@fixed@digits@after@period
- \expandafter\pgfmathroundto@impl@REVERSE\the\pgfmathfloat@tmptoks\pgfmathfloat@EOI
- \ifnum\c@pgfmathroundto@lastzeros=\c@pgfmathroundto@offsetbehindperiod
- \ifpgfmathround@impl@PREPERIOD@is@negative@zero
- % write '0.0000' instead of '-0.0000':
- \expandafter\pgfmathroundto@impl@discard@minus\the\pgfmathfloat@tmptoks\pgfmathfloat@EOI
- \fi
- \fi
- \ifnum\c@pgfmathroundto@prec=0\relax
- \expandafter\pgfmathroundto@impl@discard@period\the\pgfmathfloat@tmptoks\pgfmathfloat@EOI
- \else
- \advance\c@pgfmathroundto@prec by-\c@pgfmathroundto@offsetbehindperiod
- \c@pgfmathroundto@offsetbehindperiod=\c@pgfmathroundto@prec
- \pgfmathroundto@impl@append@zeros
- \edef\pgfmathresult{\the\pgfmathfloat@tmptoks}%
- \fi
- \else
- \pgfmathroundto@impl@discard@suffix@zeros
- \fi
+ \ifpgfmathfloat@fixed@digits@after@period
+ \expandafter\pgfmathroundto@impl@REVERSE\the\pgfmathfloat@tmptoks\pgfmathfloat@EOI
+ \ifnum\c@pgfmathroundto@lastzeros=\c@pgfmathroundto@offsetbehindperiod
+ \ifpgfmathround@impl@PREPERIOD@is@negative@zero
+ % write '0.0000' instead of '-0.0000':
+ \expandafter\pgfmathroundto@impl@discard@minus\the\pgfmathfloat@tmptoks\pgfmathfloat@EOI
+ \fi
+ \fi
+ \ifnum\c@pgfmathroundto@prec=0\relax
+ \expandafter\pgfmathroundto@impl@discard@period\the\pgfmathfloat@tmptoks\pgfmathfloat@EOI
+ \else
+ \advance\c@pgfmathroundto@prec by-\c@pgfmathroundto@offsetbehindperiod
+ \c@pgfmathroundto@offsetbehindperiod=\c@pgfmathroundto@prec
+ \pgfmathroundto@impl@append@zeros
+ \edef\pgfmathresult{\the\pgfmathfloat@tmptoks}%
+ \fi
+ \else
+ \pgfmathroundto@impl@discard@suffix@zeros
+ \fi
}
\def\pgfmathroundto@impl@discard@minus-#1\pgfmathfloat@EOI{\pgfmathfloat@tmptoks={#1}}%
% appends \c@pgfmathroundto@offsetbehindperiod zeros at the end of \pgfmathfloat@tmptoks.
\def\pgfmathroundto@impl@append@zeros{%
- \ifnum\c@pgfmathroundto@offsetbehindperiod>0
- \pgfmathfloat@tmptoks=\expandafter{\the\pgfmathfloat@tmptoks0}%
- \advance\c@pgfmathroundto@offsetbehindperiod by-1
- \pgfmathroundto@impl@append@zeros
- \fi
+ \ifnum\c@pgfmathroundto@offsetbehindperiod>0
+ \pgfmathfloat@tmptoks=\expandafter{\the\pgfmathfloat@tmptoks0}%
+ \advance\c@pgfmathroundto@offsetbehindperiod by-1
+ \pgfmathroundto@impl@append@zeros
+ \fi
}
\def\pgfmathroundto@impl@ADD@ONE{%
- \pgfmathfloat@tmptoks={}% no longer needed because its old value will be read from input
- \pgfmathroundto@impl@ADD@ONE@ITERATE
+ \pgfmathfloat@tmptoks={}% no longer needed because its old value will be read from input
+ \pgfmathroundto@impl@ADD@ONE@ITERATE
}
\def\pgfmathroundto@impl@ADD@ONE@ITERATE{%
- \pgfutil@ifnextchar\pgfmathfloat@EOI{%
- \global\pgfmathfloatroundmayneedrenormalizetrue
- \edef\pgfmathresult{1\the\pgfmathfloat@tmptoks}%
- \pgfmathroundto@impl@gobble
- }{%
- \pgfutil@ifnextchar.{%
- \ifnum\c@pgfmathroundto@prec=0
- % silently discard period in special case precision=0
- \def\pgfmathround@nextcmd{\pgfmathroundto@impl@ADD@ONE@ITERATE@gobble@dot}%
- \else
- \def\pgfmathround@nextcmd{\pgfmathroundto@impl@ADD@ONE@NEXT@COLLECT}%
- \fi
- \pgfmathround@nextcmd
- }{%
- \pgfutil@ifnextchar+{%
- \global\pgfmathfloatroundmayneedrenormalizetrue
- \edef\pgfmathresult{1\the\pgfmathfloat@tmptoks}%
- \pgfmathroundto@impl@gobble@rest
- }{%
- \pgfutil@ifnextchar-{%
- \global\pgfmathfloatroundmayneedrenormalizetrue
- \edef\pgfmathresult{-1\the\pgfmathfloat@tmptoks}%
- \pgfmathroundto@impl@gobble@rest
- }{%
- \pgfmathroundto@impl@ADD@ONE@NEXT
- }%
- }%
- }%
- }%
+ \pgfutil@ifnextchar\pgfmathfloat@EOI{%
+ \global\pgfmathfloatroundmayneedrenormalizetrue
+ \edef\pgfmathresult{1\the\pgfmathfloat@tmptoks}%
+ \pgfmathroundto@impl@gobble
+ }{%
+ \pgfutil@ifnextchar.{%
+ \ifnum\c@pgfmathroundto@prec=0
+ % silently discard period in special case precision=0
+ \def\pgfmathround@nextcmd{\pgfmathroundto@impl@ADD@ONE@ITERATE@gobble@dot}%
+ \else
+ \def\pgfmathround@nextcmd{\pgfmathroundto@impl@ADD@ONE@NEXT@COLLECT}%
+ \fi
+ \pgfmathround@nextcmd
+ }{%
+ \pgfutil@ifnextchar+{%
+ \global\pgfmathfloatroundmayneedrenormalizetrue
+ \edef\pgfmathresult{1\the\pgfmathfloat@tmptoks}%
+ \pgfmathroundto@impl@gobble@rest
+ }{%
+ \pgfutil@ifnextchar-{%
+ \global\pgfmathfloatroundmayneedrenormalizetrue
+ \edef\pgfmathresult{-1\the\pgfmathfloat@tmptoks}%
+ \pgfmathroundto@impl@gobble@rest
+ }{%
+ \pgfmathroundto@impl@ADD@ONE@NEXT
+ }%
+ }%
+ }%
+ }%
}
\def\pgfmathroundto@impl@ADD@ONE@ITERATE@gobble@dot.{%
- \pgfmathfloatroundhasperiodfalse
- \aftergroup\pgfmathfloatroundhasperiodfalse
- \pgfmathroundto@impl@ADD@ONE@ITERATE
+ \pgfmathfloatroundhasperiodfalse
+ \aftergroup\pgfmathfloatroundhasperiodfalse
+ \pgfmathroundto@impl@ADD@ONE@ITERATE
}
\def\pgfmathroundto@impl@ADD@ONE@NEXT@COLLECT#1{%
- \pgfmathfloat@tmptoks=\expandafter{\expandafter#1\the\pgfmathfloat@tmptoks}%
- \pgfmathroundto@impl@ADD@ONE@ITERATE
+ \pgfmathfloat@tmptoks=\expandafter{\expandafter#1\the\pgfmathfloat@tmptoks}%
+ \pgfmathroundto@impl@ADD@ONE@ITERATE
}
\def\pgfmathroundto@impl@ADD@ONE@NEXT#1{%
- \ifnum#1=9
- \ifnum\c@pgfmathroundto@offsetbehindperiod<0
- \ifpgfmathfloat@fixed@digits@after@period
- \pgfmathfloat@tmptoks=\expandafter{\expandafter0\the\pgfmathfloat@tmptoks}%
- \else
- % silently DROP digit
- \fi
- \else
- \pgfmathfloat@tmptoks=\expandafter{\expandafter0\the\pgfmathfloat@tmptoks}%
- \fi
- \advance\c@pgfmathroundto@offsetbehindperiod by1
- \ifnum\c@pgfmathroundto@offsetbehindperiod=0
- \ifpgfmathfloat@fixed@digits@after@period
- \def\pgfmathround@nextcmd{\pgfmathroundto@impl@ADD@ONE@ITERATE}%
- \else
- \def\pgfmathround@nextcmd{\pgfmathroundto@impl@ADD@ONE@ITERATE@gobble@dot}%
- \fi
- \else
- \def\pgfmathround@nextcmd{\pgfmathroundto@impl@ADD@ONE@ITERATE}%
- \fi
- \else
- % re-use this counter:
- \c@pgfmathroundto@lastzeros=#1
- \advance\c@pgfmathroundto@lastzeros by1
- \edef\pgfmathresult{\the\c@pgfmathroundto@lastzeros\the\pgfmathfloat@tmptoks}%
- \pgfmathfloat@tmptoks=\expandafter{\pgfmathresult}%
- \def\pgfmathround@nextcmd{\pgfmathroundto@impl@REVERSE@ITERATE}%
- \fi
- \pgfmathround@nextcmd
+ \ifnum#1=9
+ \ifnum\c@pgfmathroundto@offsetbehindperiod<0
+ \ifpgfmathfloat@fixed@digits@after@period
+ \pgfmathfloat@tmptoks=\expandafter{\expandafter0\the\pgfmathfloat@tmptoks}%
+ \else
+ % silently DROP digit
+ \fi
+ \else
+ \pgfmathfloat@tmptoks=\expandafter{\expandafter0\the\pgfmathfloat@tmptoks}%
+ \fi
+ \advance\c@pgfmathroundto@offsetbehindperiod by1
+ \ifnum\c@pgfmathroundto@offsetbehindperiod=0
+ \ifpgfmathfloat@fixed@digits@after@period
+ \def\pgfmathround@nextcmd{\pgfmathroundto@impl@ADD@ONE@ITERATE}%
+ \else
+ \def\pgfmathround@nextcmd{\pgfmathroundto@impl@ADD@ONE@ITERATE@gobble@dot}%
+ \fi
+ \else
+ \def\pgfmathround@nextcmd{\pgfmathroundto@impl@ADD@ONE@ITERATE}%
+ \fi
+ \else
+ % re-use this counter:
+ \c@pgfmathroundto@lastzeros=#1
+ \advance\c@pgfmathroundto@lastzeros by1
+ \edef\pgfmathresult{\the\c@pgfmathroundto@lastzeros\the\pgfmathfloat@tmptoks}%
+ \pgfmathfloat@tmptoks=\expandafter{\pgfmathresult}%
+ \def\pgfmathround@nextcmd{\pgfmathroundto@impl@REVERSE@ITERATE}%
+ \fi
+ \pgfmathround@nextcmd
}
\def\pgfmathroundto@impl@discard@suffix@zeros{%
- \ifnum\c@pgfmathroundto@lastzeros=\c@pgfmathroundto@offsetbehindperiod
- \ifpgfmathround@impl@PREPERIOD@is@negative@zero
- \pgfmathfloatroundhasperiodfalse
- \aftergroup\pgfmathfloatroundhasperiodfalse
- \def\pgfmathresult{0}% write '0' instead of '-0'
- \else
- \expandafter\pgfmathroundto@impl@discard@period\pgfmathround@input\pgfmathfloat@EOI
- \fi
- \else
- \ifnum\c@pgfmathroundto@lastzeros=0
- \expandafter\pgfmathroundto@impl@REVERSE\the\pgfmathfloat@tmptoks\pgfmathfloat@EOI
- \else
- \expandafter\pgfmathroundto@impl@discard@suffix@zeros@ITERATE\the\pgfmathfloat@tmptoks\pgfmathfloat@EOI
- \fi
- \fi
-}
-
-% PRECONDITION:
-% \c@pgfmathroundto@lastzeros > 0
+ \ifnum\c@pgfmathroundto@lastzeros=\c@pgfmathroundto@offsetbehindperiod
+ \ifpgfmathround@impl@PREPERIOD@is@negative@zero
+ \pgfmathfloatroundhasperiodfalse
+ \aftergroup\pgfmathfloatroundhasperiodfalse
+ \def\pgfmathresult{0}% write '0' instead of '-0'
+ \else
+ \expandafter\pgfmathroundto@impl@discard@period\pgfmathround@input\pgfmathfloat@EOI
+ \fi
+ \else
+ \ifnum\c@pgfmathroundto@lastzeros=0
+ \expandafter\pgfmathroundto@impl@REVERSE\the\pgfmathfloat@tmptoks\pgfmathfloat@EOI
+ \else
+ \expandafter\pgfmathroundto@impl@discard@suffix@zeros@ITERATE\the\pgfmathfloat@tmptoks\pgfmathfloat@EOI
+ \fi
+ \fi
+}
+
+% PRECONDITION:
+% \c@pgfmathroundto@lastzeros > 0
\def\pgfmathroundto@impl@discard@suffix@zeros@ITERATE#1{%
- \advance\c@pgfmathroundto@lastzeros by-1
- \ifnum\c@pgfmathroundto@lastzeros=0
- \def\pgfmathround@nextcmd{\pgfmathroundto@impl@REVERSE}%
- \else
- \def\pgfmathround@nextcmd{\pgfmathroundto@impl@discard@suffix@zeros@ITERATE}%
- \fi
- \pgfmathround@nextcmd
+ \advance\c@pgfmathroundto@lastzeros by-1
+ \ifnum\c@pgfmathroundto@lastzeros=0
+ \def\pgfmathround@nextcmd{\pgfmathroundto@impl@REVERSE}%
+ \else
+ \def\pgfmathround@nextcmd{\pgfmathroundto@impl@discard@suffix@zeros@ITERATE}%
+ \fi
+ \pgfmathround@nextcmd
}
% Usage:
% \pgfmathroundto@impl@REVERSE#1\pgfmathfloat@EOI
% -> writes #1 reversed into \pgfmathfloat@tmptoks
\def\pgfmathroundto@impl@REVERSE{%
- \pgfmathfloat@tmptoks={}%
- \pgfmathroundto@impl@REVERSE@ITERATE
+ \pgfmathfloat@tmptoks={}%
+ \pgfmathroundto@impl@REVERSE@ITERATE
}
\def\pgfmathroundto@impl@REVERSE@ITERATE{%
- \pgfutil@ifnextchar\pgfmathfloat@EOI{%
- \edef\pgfmathresult{\the\pgfmathfloat@tmptoks}%
- \pgfmathroundto@impl@gobble
- }{%
- \pgfmathroundto@impl@REVERSE@NEXT
- }%
+ \pgfutil@ifnextchar\pgfmathfloat@EOI{%
+ \edef\pgfmathresult{\the\pgfmathfloat@tmptoks}%
+ \pgfmathroundto@impl@gobble
+ }{%
+ \pgfmathroundto@impl@REVERSE@NEXT
+ }%
}
\def\pgfmathroundto@impl@REVERSE@NEXT#1{%
- \pgfmathfloat@tmptoks=\expandafter{\expandafter#1\the\pgfmathfloat@tmptoks}%
- \pgfmathroundto@impl@REVERSE@ITERATE
+ \pgfmathfloat@tmptoks=\expandafter{\expandafter#1\the\pgfmathfloat@tmptoks}%
+ \pgfmathroundto@impl@REVERSE@ITERATE
}
\def\pgfmathroundto@impl@BEGIN@DOT.{%
- \pgfmathfloat@tmptoks=\expandafter{\expandafter.\the\pgfmathfloat@tmptoks}%
- \c@pgfmathroundto@offsetbehindperiod=0
- \pgfmathroundto@impl@ITERATE@DOT
+ \pgfmathfloat@tmptoks=\expandafter{\expandafter.\the\pgfmathfloat@tmptoks}%
+ \c@pgfmathroundto@offsetbehindperiod=0
+ \pgfmathroundto@impl@ITERATE@DOT
}
\def\pgfmathroundto@impl@ITERATE@DOT{%
- \pgfutil@ifnextchar\pgfmathfloat@EOI{%
- % finished.
- \pgfmathroundto@impl@gobble@and@start
- }{%
- \pgfmathroundto@impl@NEXT@DOT
- }%
+ \pgfutil@ifnextchar\pgfmathfloat@EOI{%
+ % finished.
+ \pgfmathroundto@impl@gobble@and@start
+ }{%
+ \pgfmathroundto@impl@NEXT@DOT
+ }%
}
\def\pgfmathroundto@impl@NEXT@DOT#1{%
- \ifnum\c@pgfmathroundto@offsetbehindperiod=\c@pgfmathroundto@prec
- \def\pgfmathround@next{#1}%
- \def\pgfmathround@nextcmd{\pgfmathroundto@impl@gobble@rest@and@start}%
- \else
- \advance\c@pgfmathroundto@offsetbehindperiod by1
- \ifnum#1=0
- \advance\c@pgfmathroundto@lastzeros by1
- \else
- \c@pgfmathroundto@lastzeros=0
- \fi
- \pgfmathfloat@tmptoks=\expandafter{\expandafter#1\the\pgfmathfloat@tmptoks}%
- \def\pgfmathround@nextcmd{\pgfmathroundto@impl@ITERATE@DOT}%
- \fi
- \pgfmathround@nextcmd
+ \ifnum\c@pgfmathroundto@offsetbehindperiod=\c@pgfmathroundto@prec
+ \def\pgfmathround@next{#1}%
+ \def\pgfmathround@nextcmd{\pgfmathroundto@impl@gobble@rest@and@start}%
+ \else
+ \advance\c@pgfmathroundto@offsetbehindperiod by1
+ \ifnum#1=0
+ \advance\c@pgfmathroundto@lastzeros by1
+ \else
+ \c@pgfmathroundto@lastzeros=0
+ \fi
+ \pgfmathfloat@tmptoks=\expandafter{\expandafter#1\the\pgfmathfloat@tmptoks}%
+ \def\pgfmathround@nextcmd{\pgfmathroundto@impl@ITERATE@DOT}%
+ \fi
+ \pgfmathround@nextcmd
}%
% in contrast to pgfmathroundto@impl@ITERATE@NODOT, this method here
% checks also for signs
\def\pgfmathroundto@impl@ITERATE@NODOT@firstcall#1{%
- \def\pgfmathround@cur{#1}%
- \ifx\pgfmathround@cur\pgfmathfloat@EOI
- \pgfmathround@impl@PREPERIOD@is@negative@zerofalse
- \def\pgfmathround@nextcmd{\pgfmathroundto@impl@start}%
- \else
- \ifx\pgfmathround@cur\pgfmathfloatparsenumber@tok@PERIOD
- \pgfmathround@impl@PREPERIOD@is@negative@zerofalse
- \def\pgfmathround@nextcmd{\pgfmathroundto@impl@BEGIN@DOT.}%
- \else
- \ifx\pgfmathround@cur\pgfmathfloatparsenumber@tok@MINUS
- \else
- \pgfmathround@impl@PREPERIOD@is@negative@zerofalse
- \fi
- \pgfmathfloat@tmptoks=\expandafter{\expandafter#1\the\pgfmathfloat@tmptoks}%
- \def\pgfmathround@nextcmd{\pgfmathroundto@impl@ITERATE@NODOT}%
- \fi
- \fi
- \pgfmathround@nextcmd
+ \def\pgfmathround@cur{#1}%
+ \ifx\pgfmathround@cur\pgfmathfloat@EOI
+ \pgfmathround@impl@PREPERIOD@is@negative@zerofalse
+ \def\pgfmathround@nextcmd{\pgfmathroundto@impl@start}%
+ \else
+ \ifx\pgfmathround@cur\pgfmathfloatparsenumber@tok@PERIOD
+ \pgfmathround@impl@PREPERIOD@is@negative@zerofalse
+ \def\pgfmathround@nextcmd{\pgfmathroundto@impl@BEGIN@DOT.}%
+ \else
+ \ifx\pgfmathround@cur\pgfmathfloatparsenumber@tok@MINUS
+ \else
+ \pgfmathround@impl@PREPERIOD@is@negative@zerofalse
+ \fi
+ \pgfmathfloat@tmptoks=\expandafter{\expandafter#1\the\pgfmathfloat@tmptoks}%
+ \def\pgfmathround@nextcmd{\pgfmathroundto@impl@ITERATE@NODOT}%
+ \fi
+ \fi
+ \pgfmathround@nextcmd
}
\def\pgfmathroundto@impl@ITERATE@NODOT#1{%
- \def\pgfmathround@cur{#1}%
- \ifx\pgfmathround@cur\pgfmathfloat@EOI
- \def\pgfmathround@nextcmd{\pgfmathroundto@impl@start}%
- \else
- \ifx\pgfmathround@cur\pgfmathfloatparsenumber@tok@PERIOD
- \def\pgfmathround@nextcmd{\pgfmathroundto@impl@BEGIN@DOT.}%
- \else
- \ifx\pgfmathround@cur\pgfmathfloatparsenumber@tok@ZERO
- \else
- \pgfmathround@impl@PREPERIOD@is@negative@zerofalse
- \fi
- \pgfmathfloat@tmptoks=\expandafter{\expandafter#1\the\pgfmathfloat@tmptoks}%
- \def\pgfmathround@nextcmd{\pgfmathroundto@impl@ITERATE@NODOT}%
- \fi
- \fi
- \pgfmathround@nextcmd
+ \def\pgfmathround@cur{#1}%
+ \ifx\pgfmathround@cur\pgfmathfloat@EOI
+ \def\pgfmathround@nextcmd{\pgfmathroundto@impl@start}%
+ \else
+ \ifx\pgfmathround@cur\pgfmathfloatparsenumber@tok@PERIOD
+ \def\pgfmathround@nextcmd{\pgfmathroundto@impl@BEGIN@DOT.}%
+ \else
+ \ifx\pgfmathround@cur\pgfmathfloatparsenumber@tok@ZERO
+ \else
+ \pgfmathround@impl@PREPERIOD@is@negative@zerofalse
+ \fi
+ \pgfmathfloat@tmptoks=\expandafter{\expandafter#1\the\pgfmathfloat@tmptoks}%
+ \def\pgfmathround@nextcmd{\pgfmathroundto@impl@ITERATE@NODOT}%
+ \fi
+ \fi
+ \pgfmathround@nextcmd
}
%--------------------------------------------
@@ -2123,20 +2122,20 @@
% \ifpgfmathfloatroundhasperiod will be set after the current TeX
% group.
\def\pgfmathfloatround@impl{%
- \expandafter\pgfmathroundto@impl\expandafter{\the\pgfmathfloat@a@Mtok}%
- \ifpgfmathfloatroundmayneedrenormalize
- \ifpgfmathfloatroundhasperiod
- \expandafter\pgfmathfloatround@impl@renormalize\pgfmathresult\pgfmathfloat@EOI%
- \else
- \expandafter\pgfmathfloatround@impl@renormalize\pgfmathresult.\pgfmathfloat@EOI%
- \fi
- \advance\pgfmathfloat@a@E by1
- \fi
- \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\pgfmathresult}{\the\pgfmathfloat@a@E}%
+ \expandafter\pgfmathroundto@impl\expandafter{\the\pgfmathfloat@a@Mtok}%
+ \ifpgfmathfloatroundmayneedrenormalize
+ \ifpgfmathfloatroundhasperiod
+ \expandafter\pgfmathfloatround@impl@renormalize\pgfmathresult\pgfmathfloat@EOI%
+ \else
+ \expandafter\pgfmathfloatround@impl@renormalize\pgfmathresult.\pgfmathfloat@EOI%
+ \fi
+ \advance\pgfmathfloat@a@E by1
+ \fi
+ \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\pgfmathresult}{\the\pgfmathfloat@a@E}%
}
\def\pgfmathfloatround@impl@renormalize#1#2.#3\pgfmathfloat@EOI{%
- \pgfmathroundto@impl{#1.#2#3}%
+ \pgfmathroundto@impl{#1.#2#3}%
}
@@ -2146,106 +2145,106 @@
% ATTENTION: this thing REQUIRES a period in the mantissa!
% collects everything into \pgfmathresult
\def\pgfmathfloattofixed@impl#1.#2\relax{%
- \ifnum\pgfmathfloat@a@E<0
- \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
- \edef\pgfmathresult{\the\pgfmathfloat@a@Mtok #1}%
- \else
- \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@collectmantissa#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
+ \ifnum\pgfmathfloat@a@E<0
+ \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
+ \edef\pgfmathresult{\the\pgfmathfloat@a@Mtok #1}%
+ \else
+ \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@collectmantissa#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@collectmantissa#9\count\pgfmathfloat@a@E
- \fi
+ \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@collectmantissa#9\count\pgfmathfloat@a@E
+ \fi
}%
\def\pgfmathfloattofixed@impl@collectmantissa#1#2\count#3{%
- \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok #1}%
- \advance\pgfmathfloat@a@E by-1%
- \def\pgfmathfloat@loc@TMPb{#2}%
- \ifx\pgfmathfloat@loc@TMPb\pgfutil@empty
- \pgfutil@loop
- \ifnum\pgfmathfloat@a@E>0%
- \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok 0}%
- \advance\pgfmathfloat@a@E by-1%
- \pgfutil@repeat
- \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok .0}%
- \else
- \ifnum\pgfmathfloat@a@E=0
- \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok .#2}%
- \else
- \pgfmathfloattofixed@impl@collectmantissa#2\count#3%
- \fi
- \fi
+ \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok #1}%
+ \advance\pgfmathfloat@a@E by-1%
+ \def\pgfmathfloat@loc@TMPb{#2}%
+ \ifx\pgfmathfloat@loc@TMPb\pgfutil@empty
+ \pgfutil@loop
+ \ifnum\pgfmathfloat@a@E>0%
+ \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok 0}%
+ \advance\pgfmathfloat@a@E by-1%
+ \pgfutil@repeat
+ \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok .0}%
+ \else
+ \ifnum\pgfmathfloat@a@E=0
+ \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok .#2}%
+ \else
+ \pgfmathfloattofixed@impl@collectmantissa#2\count#3%
+ \fi
+ \fi
}
@@ -2276,46 +2275,46 @@
%
% It assigns \pgfmathfloat@a@S, \pgfmathfloat@a@Mtok, \pgfmathfloat@a@E.
\def\pgfflt@impl#1{%
- \pgfmathfloatparsenumberpendingperiodfalse
- \pgfmathfloat@tmptoks={}% this register is used to collect PENDING ZEROS
- \pgfmathfloat@a@E=0
- % start parsing: check for sign:
- \expandafter\ifx\csname pgfflt@#1\endcsname\relax
- \pgfmathfloat@a@S=1
- \expandafter\pgfflt@init\expandafter#1%
- \else
- \expandafter\expandafter\csname pgfflt@#1\endcsname
- \fi
+ \pgfmathfloatparsenumberpendingperiodfalse
+ \pgfmathfloat@tmptoks={}% this register is used to collect PENDING ZEROS
+ \pgfmathfloat@a@E=0
+ % start parsing: check for sign:
+ \expandafter\ifx\csname pgfflt@#1\endcsname\relax
+ \pgfmathfloat@a@S=1
+ \expandafter\pgfflt@init\expandafter#1%
+ \else
+ \expandafter\expandafter\csname pgfflt@#1\endcsname
+ \fi
}
% State transitions:
\expandafter\def\csname pgfflt@+\endcsname{%
- \pgfmathfloat@a@S=1 %
- \pgfflt@init}%
+ \pgfmathfloat@a@S=1 %
+ \pgfflt@init}%
\expandafter\def\csname pgfflt@-\endcsname{%
- \pgfmathfloat@a@S=2 %
- \pgfflt@init}%
+ \pgfmathfloat@a@S=2 %
+ \pgfflt@init}%
\expandafter\def\csname pgfflt@\pgfflt@EOI\endcsname{%
- \pgfmathfloatparsenumber@handleerror{empty number}{}{}}%
+ \pgfmathfloatparsenumber@handleerror{empty number}{}{}}%
\pgfkeys{
- /pgf/fpu/handlers/empty number/.style 2 args={%
- /pgf/fpu/handlers/invalid number={#1}{#2}%
- },
- /pgf/fpu/empty number is zero/.style={%
- /pgf/fpu/handlers/empty number/.code 2 args={%
- \pgfmathfloatcreate{0}{0.0}{0}%
- }%
- },%
- /pgf/fpu/handlers/invalid separator/.code 2 args={%
- \pgfmath@error{Could not parse input '#1' as a floating point number, sorry. The unreadable part was near the decimal separator '#2'. Do you need the option 'read comma as period'?}{}%
- },
- /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'.}{}%
- },
- /pgf/fpu/handlers/wrong lowlevel format/.code 2 args={%
- \pgfmath@error{Sorry, an internal routine of the floating point unit got an ill-formatted floating point number `#1'. The unreadable part was near '#2'.}{}%
- \let\pgfmathresult=\pgfutil@empty
- },
+ /pgf/fpu/handlers/empty number/.style 2 args={%
+ /pgf/fpu/handlers/invalid number={#1}{#2}%
+ },
+ /pgf/fpu/empty number is zero/.style={%
+ /pgf/fpu/handlers/empty number/.code 2 args={%
+ \pgfmathfloatcreate{0}{0.0}{0}%
+ }%
+ },%
+ /pgf/fpu/handlers/invalid separator/.code 2 args={%
+ \pgfmath@error{Could not parse input '#1' as a floating point number, sorry. The unreadable part was near the decimal separator '#2'. Do you need the option 'read comma as period'?}{}%
+ },
+ /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'.}{}%
+ },
+ /pgf/fpu/handlers/wrong lowlevel format/.code 2 args={%
+ \pgfmath@error{Sorry, an internal routine of the floating point unit got an ill-formatted floating point number `#1'. The unreadable part was near '#2'.}{}%
+ \let\pgfmathresult=\pgfutil@empty
+ },
}
% #1 the error handler
@@ -2323,30 +2322,30 @@
% #3 the part which produced the error
%
% POSTCONDITION: the three registers
-% \pgfmathfloat@a@S
-% \pgfmathfloat@a@Mtok
-% \pgfmathfloat@a@E
+% \pgfmathfloat@a@S
+% \pgfmathfloat@a@Mtok
+% \pgfmathfloat@a@E
% will contain the number which results from the error handler.
\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
+ \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
}
\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
+ \begingroup
+ \pgfmathfloat@a@Mtok={#1}%
+ \xdef\pgfmathfloat@glob@TMP{%
+ \noexpand\pgfmathfloatparsenumber@handleerror
+ {invalid number}{\pgfmathresult}{\the\pgfmathfloat@a@Mtok}}%
+ \endgroup
+ \pgfmathfloat@glob@TMP
}%
@@ -2354,11 +2353,11 @@
% FROM: checksign.
%
\def\pgfflt@init#1{%
- \expandafter\ifx\csname pgffltA@#1\endcsname\relax
- \expandafter\pgfflt@error\expandafter#1%
- \else
- \expandafter\expandafter\csname pgffltA@#1\endcsname
- \fi}
+ \expandafter\ifx\csname pgffltA@#1\endcsname\relax
+ \expandafter\pgfflt@error\expandafter#1%
+ \else
+ \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}%
@@ -2371,82 +2370,82 @@
\expandafter\def\csname pgffltA@8\endcsname{\pgfflt@nonzerodigit8}%
\expandafter\def\csname pgffltA@9\endcsname{\pgfflt@nonzerodigit9}%
\def\pgfflt@nonzerodigit#1{%
- \pgfmathfloat@a@Mtok={#1}%
- \pgfmathfloatparsenumberpendingperiodtrue
- \pgfflt@positiveexp}%
+ \pgfmathfloat@a@Mtok={#1}%
+ \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?
\expandafter\def\csname pgffltA@.\endcsname{% read '.9' like '0.9'
- \pgfmathfloat@a@E=-1
- \pgfflt@leadingzero@foundperiod}%
+ \pgfmathfloat@a@E=-1
+ \pgfflt@leadingzero@foundperiod}%
\expandafter\def\csname pgffltA@,\endcsname{% read ',9' like '0,9'
- \pgfmathfloat@frenchinput{%
- \pgfmathfloat@a@E=-1
- \pgfflt@leadingzero@foundperiod
- }%
+ \pgfmathfloat@frenchinput{%
+ \pgfmathfloat@a@E=-1
+ \pgfflt@leadingzero@foundperiod
+ }%
}%
\def\pgfmathfloat@frenchinput#1{%
- \ifpgfmathparsenumber@comma@as@period
- \def\pgf@marshal{#1}%
- \expandafter\pgf@marshal
- \else
- \expandafter\pgfflt@error@separator\expandafter,%
- \fi
+ \ifpgfmathparsenumber@comma@as@period
+ \def\pgf@marshal{#1}%
+ \expandafter\pgf@marshal
+ \else
+ \expandafter\pgfflt@error@separator\expandafter,%
+ \fi
}%
\def\pgfflt@error@separator#1\pgfflt@EOI{%
- \begingroup
- \pgfmathfloat@a@Mtok={#1}%
- \xdef\pgfmathfloat@glob@TMP{%
- \noexpand\pgfmathfloatparsenumber@handleerror
- {invalid separator}{\pgfmathresult}{\the\pgfmathfloat@a@Mtok}}%
- \endgroup
- \pgfmathfloat@glob@TMP
+ \begingroup
+ \pgfmathfloat@a@Mtok={#1}%
+ \xdef\pgfmathfloat@glob@TMP{%
+ \noexpand\pgfmathfloatparsenumber@handleerror
+ {invalid separator}{\pgfmathresult}{\the\pgfmathfloat@a@Mtok}}%
+ \endgroup
+ \pgfmathfloat@glob@TMP
}%
\def\pgfflt@finish#1\pgfflt@EOI{}
\def\pgfflt@readnan #1#2{%
- \def\pgfflt@readnan@ok{1}%
- \if#1a\else\if#1A\else\def\pgfflt@readnan@ok{0}\fi\fi
- \if#2n\else\if#2N\else\def\pgfflt@readnan@ok{0}\fi\fi
- \if\pgfflt@readnan@ok1%
- \pgfmathfloat@a@S=3\relax%
- \pgfmathfloat@a@Mtok={0.0}%
- \pgfmathfloat@a@E=0%
- \expandafter\pgfflt@finish
- \else
- \def\pgfflt@readnan@{\pgfflt@error #1#2}%
- \expandafter\pgfflt@readnan@
- \fi
+ \def\pgfflt@readnan@ok{1}%
+ \if#1a\else\if#1A\else\def\pgfflt@readnan@ok{0}\fi\fi
+ \if#2n\else\if#2N\else\def\pgfflt@readnan@ok{0}\fi\fi
+ \if\pgfflt@readnan@ok1%
+ \pgfmathfloat@a@S=3\relax%
+ \pgfmathfloat@a@Mtok={0.0}%
+ \pgfmathfloat@a@E=0%
+ \expandafter\pgfflt@finish
+ \else
+ \def\pgfflt@readnan@{\pgfflt@error #1#2}%
+ \expandafter\pgfflt@readnan@
+ \fi
}
\def\pgfflt@readinf #1#2{%
- \def\pgfflt@readinf@ok{1}%
- \if#1n\else\if#1N\else\def\pgfflt@readinf@ok{0}\fi\fi
- \if#2f\else\if#2F\else\def\pgfflt@readinf@ok{0}\fi\fi
- \if\pgfflt@readinf@ok1%
- \ifnum\pgfmathfloat@a@S=1 %
- \pgfmathfloat@a@S=4 %
- \pgfmathfloat@a@Mtok={0.0}%
- \else
- \pgfmathfloat@a@S=5 %
- \pgfmathfloat@a@Mtok={0.0}%
- \fi
- \pgfmathfloat@a@E=0 %
- \expandafter\pgfflt@finish
- \else
- \def\pgfflt@readinf@{\pgfflt@error #1#2}%
- \expandafter\pgfflt@readinf@
- \fi
+ \def\pgfflt@readinf@ok{1}%
+ \if#1n\else\if#1N\else\def\pgfflt@readinf@ok{0}\fi\fi
+ \if#2f\else\if#2F\else\def\pgfflt@readinf@ok{0}\fi\fi
+ \if\pgfflt@readinf@ok1%
+ \ifnum\pgfmathfloat@a@S=1 %
+ \pgfmathfloat@a@S=4 %
+ \pgfmathfloat@a@Mtok={0.0}%
+ \else
+ \pgfmathfloat@a@S=5 %
+ \pgfmathfloat@a@Mtok={0.0}%
+ \fi
+ \pgfmathfloat@a@E=0 %
+ \expandafter\pgfflt@finish
+ \else
+ \def\pgfflt@readinf@{\pgfflt@error #1#2}%
+ \expandafter\pgfflt@readinf@
+ \fi
}
\def\pgfflt@leadingzero#1{%
- \expandafter\ifx\csname pgffltB@#1\endcsname\relax
- \expandafter\pgfflt@error\expandafter#1%
- \else
- \expandafter\expandafter\csname pgffltB@#1\endcsname
- \fi}
+ \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}
@@ -2460,35 +2459,35 @@
\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}%
+ \pgfmathfloat@a@E=-1
+ \pgfflt@leadingzero@foundperiod}%
\expandafter\def\csname pgffltB@,\endcsname{%
- \pgfmathfloat@frenchinput{%
- \pgfmathfloat@a@E=-1
- \pgfflt@leadingzero@foundperiod
- }%
+ \pgfmathfloat@frenchinput{%
+ \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}%
+ \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}%
+ \pgfmathfloat@a@S=0\relax%
+ \pgfmathfloat@a@Mtok={0.0}%
+ \pgfmathfloat@a@E=0}%
\def\pgfflt@leadingzero@foundperiod#1{%
- \expandafter\ifx\csname pgffltC@#1\endcsname\relax
- \expandafter\pgfflt@error\expandafter#1%
- \else
- \expandafter\expandafter\csname pgffltC@#1\endcsname
- \fi}
+ \expandafter\ifx\csname pgffltC@#1\endcsname\relax
+ \expandafter\pgfflt@error\expandafter#1%
+ \else
+ \expandafter\expandafter\csname pgffltC@#1\endcsname
+ \fi}
% State transitions:
\expandafter\def\csname pgffltC@0\endcsname{%
- \advance\pgfmathfloat@a@E by-1
- \pgfflt@leadingzero@foundperiod}%
+ \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}%
@@ -2499,28 +2498,28 @@
\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}%
+ \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}%
+ \pgfmathfloat@a@S=0\relax%
+ \pgfmathfloat@a@Mtok={0.0}%
+ \pgfmathfloat@a@E=0}%
\def\pgfflt@positiveexp#1{%
- \expandafter\ifx\csname pgffltD@#1\endcsname\relax
- \expandafter\pgfflt@error\expandafter#1%
- \else
- \expandafter\expandafter\csname pgffltD@#1\endcsname
- \fi}
+ \expandafter\ifx\csname pgffltD@#1\endcsname\relax
+ \expandafter\pgfflt@error\expandafter#1%
+ \else
+ \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}%
+ \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}%
@@ -2537,51 +2536,51 @@
\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
- \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok#1}%
- \pgfflt@positiveexp}%
+ \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}%
+ \pgfflt@positiveexp}%
% 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
+ \pgfmathfloatparsenumberpendingperiodfalse
+ \pgfmathfloat@a@S=\the\pgfmathfloat@a@Mtok\relax
+ \pgfmathfloat@a@Mtok={#1}%
+ \pgfmathfloat@a@E=#2
}%
\def\pgfflt@readexponent#1\pgfflt@EOI{%
- \afterassignment\pgfflt@readexponent@
- \pgfmathfloat@b@E=#1 \pgfflt@EOI% the white space is important, otherwise \pgfflt@EOI will be expanded.
+ \afterassignment\pgfflt@readexponent@
+ \pgfmathfloat@b@E=#1 \pgfflt@EOI% the white space is important, otherwise \pgfflt@EOI will be expanded.
}
\def\pgfflt@readexponent@#1{%
- \advance\pgfmathfloat@a@E by\pgfmathfloat@b@E\relax
- %
- % sanity checking:
- \def\pgfmathfloat@loc@TMPb{#1}%
- \ifx\pgfmathfloat@loc@TMPb\pgfflt@EOI@unexpanded
- \else
- \def\pgfmathfloat@loc@TMPb{\pgfflt@error#1}%
- \expandafter\pgfmathfloat@loc@TMPb
- \fi
+ \advance\pgfmathfloat@a@E by\pgfmathfloat@b@E\relax
+ %
+ % sanity checking:
+ \def\pgfmathfloat@loc@TMPb{#1}%
+ \ifx\pgfmathfloat@loc@TMPb\pgfflt@EOI@unexpanded
+ \else
+ \def\pgfmathfloat@loc@TMPb{\pgfflt@error#1}%
+ \expandafter\pgfmathfloat@loc@TMPb
+ \fi
}
\def\pgfflt@pendingzeros@positiveexp#1{%
- \expandafter\ifx\csname pgffltE@#1\endcsname\relax
- \expandafter\pgfflt@error\expandafter#1%
- \else
- \expandafter\expandafter\csname pgffltE@#1\endcsname
- \fi}
+ \expandafter\ifx\csname pgffltE@#1\endcsname\relax
+ \expandafter\pgfflt@error\expandafter#1%
+ \else
+ \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}%
+ \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}%
@@ -2597,26 +2596,26 @@
\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
- \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}%
+ \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}%
+ \pgfflt@positiveexp}%
\def\pgfflt@finish@number@after@period#1{%
- \expandafter\ifx\csname pgffltF@#1\endcsname\relax
- \expandafter\pgfflt@error\expandafter#1%
- \else
- \expandafter\expandafter\csname pgffltF@#1\endcsname
- \fi}
+ \expandafter\ifx\csname pgffltF@#1\endcsname\relax
+ \expandafter\pgfflt@error\expandafter#1%
+ \else
+ \expandafter\expandafter\csname pgffltF@#1\endcsname
+ \fi}
% State transitions:
\expandafter\def\csname pgffltF@0\endcsname{%
- \pgfmathfloat@tmptoks=\expandafter{\the\pgfmathfloat@tmptoks0}%
- \pgfflt@pendingzeros}%
+ \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}%
@@ -2630,26 +2629,26 @@
\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
- \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}%
+ \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}%
+ \pgfflt@finish@number@after@period}%
\def\pgfflt@pendingzeros#1{%
- \expandafter\ifx\csname pgffltG@#1\endcsname\relax
- \expandafter\pgfflt@error\expandafter#1%
- \else
- \expandafter\expandafter\csname pgffltG@#1\endcsname
- \fi}
+ \expandafter\ifx\csname pgffltG@#1\endcsname\relax
+ \expandafter\pgfflt@error\expandafter#1%
+ \else
+ \expandafter\expandafter\csname pgffltG@#1\endcsname
+ \fi}
% State transitions:
\expandafter\def\csname pgffltG@0\endcsname{%
- \pgfmathfloat@tmptoks=\expandafter{\the\pgfmathfloat@tmptoks0}%
- \pgfflt@pendingzeros}%
+ \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}%
@@ -2663,13 +2662,13 @@
\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
- \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}%
+ \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}%
+ \pgfflt@finish@number@after@period}%
\endinput
diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.base.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.base.code.tex
index 581cdaade5f..9370a219fe3 100644
--- a/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.base.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.base.code.tex
@@ -14,46 +14,46 @@
% Base conversion operations for the parser.
%
\pgfmathdeclarefunction{bin}{1}{%
- \begingroup%
- \afterassignment\pgfmath@gobbletilpgfmath@%
- \c@pgfmath@counta=#1\relax\pgfmath@%
- \expandafter\pgfmathbasetobase\expandafter\pgfmathresult\expandafter{\the\c@pgfmath@counta}{10}{2}%
- \pgfmath@smuggleone\pgfmathresult%
- \endgroup%
+ \begingroup%
+ \afterassignment\pgfmath@gobbletilpgfmath@%
+ \c@pgfmath@counta=#1\relax\pgfmath@%
+ \expandafter\pgfmathbasetobase\expandafter\pgfmathresult\expandafter{\the\c@pgfmath@counta}{10}{2}%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
}
\pgfmathdeclarefunction{hex}{1}{%
- \begingroup%
- \afterassignment\pgfmath@gobbletilpgfmath@%
- \c@pgfmath@counta=#1\relax\pgfmath@%
- \expandafter\pgfmathbasetobase\expandafter\pgfmathresult\expandafter{\the\c@pgfmath@counta}{10}{16}%
- \pgfmath@smuggleone\pgfmathresult%
- \endgroup%
-}
+ \begingroup%
+ \afterassignment\pgfmath@gobbletilpgfmath@%
+ \c@pgfmath@counta=#1\relax\pgfmath@%
+ \expandafter\pgfmathbasetobase\expandafter\pgfmathresult\expandafter{\the\c@pgfmath@counta}{10}{16}%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
\pgfmathdeclarefunction{Hex}{1}{%
- \begingroup%
- \afterassignment\pgfmath@gobbletilpgfmath@%
- \c@pgfmath@counta=#1\relax\pgfmath@%
- \expandafter\pgfmathbasetoBase\expandafter\pgfmathresult\expandafter{\the\c@pgfmath@counta}{10}{16}%
- \pgfmath@smuggleone\pgfmathresult%
- \endgroup%
+ \begingroup%
+ \afterassignment\pgfmath@gobbletilpgfmath@%
+ \c@pgfmath@counta=#1\relax\pgfmath@%
+ \expandafter\pgfmathbasetoBase\expandafter\pgfmathresult\expandafter{\the\c@pgfmath@counta}{10}{16}%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
}
\pgfmathdeclarefunction{oct}{1}{%
- \begingroup%
- \afterassignment\pgfmath@gobbletilpgfmath@%
- \c@pgfmath@counta=#1\relax\pgfmath@%
- \expandafter\pgfmathbasetobase\expandafter\pgfmathresult\expandafter{\the\c@pgfmath@counta}{10}{8}%
- \pgfmath@smuggleone\pgfmathresult%
- \endgroup%
+ \begingroup%
+ \afterassignment\pgfmath@gobbletilpgfmath@%
+ \c@pgfmath@counta=#1\relax\pgfmath@%
+ \expandafter\pgfmathbasetobase\expandafter\pgfmathresult\expandafter{\the\c@pgfmath@counta}{10}{8}%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
}
% Additional macros:
% \pgfmathbasetodec
%
-% Convert a representation of an integer from
-% the spcified base to base 10.
+% Convert a representation of an integer from
+% the specified base to base 10.
%
% #1 - a macro to store the result.
% #2 - the representation of a number (i.e. not a register)
@@ -66,62 +66,62 @@
% \mynumber <- 23
%
\def\pgfmathbasetodec#1#2#3{%
- \pgfmath@checknumber{#2}%
- \pgfmath@checkbase{#3}%
- \def\pgfmath@base{#3}%
- \def\pgfmath@base@macro{#1}%
- \c@pgfmath@counta=1\relax%
- \let\pgfmath@reversed=\pgfmath@empty%
- \expandafter\pgfmathbasetodec@#2\pgfmath@base@stop}
-
+ \pgfmath@checknumber{#2}%
+ \pgfmath@checkbase{#3}%
+ \def\pgfmath@base{#3}%
+ \def\pgfmath@base@macro{#1}%
+ \c@pgfmath@counta=1\relax%
+ \let\pgfmath@reversed=\pgfmath@empty%
+ \expandafter\pgfmathbasetodec@#2\pgfmath@base@stop}
+
\def\pgfmathbasetodec@#1{%
- \ifx#1\pgfmath@base@stop%
- \c@pgfmath@countb=0%
- \divide\c@pgfmath@counta by\pgfmath@base\relax%
- \expandafter\pgfmathbasetodec@@%
- \else%
- \edef\pgfmath@reversed{\pgfmath@reversed#1}%
- \expandafter\multiply\expandafter\c@pgfmath@counta\pgfmath@base\relax%
- \expandafter\pgfmathbasetodec@%
- \fi}
+ \ifx#1\pgfmath@base@stop%
+ \c@pgfmath@countb=0%
+ \divide\c@pgfmath@counta by\pgfmath@base\relax%
+ \expandafter\pgfmathbasetodec@@%
+ \else%
+ \edef\pgfmath@reversed{\pgfmath@reversed#1}%
+ \expandafter\multiply\expandafter\c@pgfmath@counta\pgfmath@base\relax%
+ \expandafter\pgfmathbasetodec@%
+ \fi}
\def\pgfmathbasetodec@@{\expandafter\pgfmathbasetodec@@@\pgfmath@reversed\pgfmathbasetodec}
-
+
\def\pgfmathbasetodec@@@#1{%
- \ifx\pgfmathbasetodec#1\relax%
- \expandafter\edef\pgfmath@base@macro{\the\c@pgfmath@countb}%
- \let\pgfmath@next=\pgfmathbasetodec@@@@%
- \else%
- \chardef\pgfmath@charnum`#1\relax%
- \c@pgfmath@countc=\pgfmath@charnum\relax%
- \ifnum\c@pgfmath@countc>96\relax%
- \advance\c@pgfmath@countc by-87\relax%
- \else
- \ifnum\c@pgfmath@countc>64\relax%
- \advance\c@pgfmath@countc by-55\relax%
- \else
- \advance\c@pgfmath@countc by-48\relax%
- \fi%
- \fi%
- \ifnum\c@pgfmath@countc<\pgfmath@base\relax%
- \multiply\c@pgfmath@countc by\c@pgfmath@counta%
- \advance\c@pgfmath@countb by\c@pgfmath@countc%
- \divide\c@pgfmath@counta by\pgfmath@base\relax%
- \let\pgfmath@next\pgfmathbasetodec@@@%
- \else
- \pgfmath@error{Digit `#1' invalid for base \pgfmath@base}%
- \let\pgfmath@next=\relax%
- \fi%
- \fi%
- \pgfmath@next}
+ \ifx\pgfmathbasetodec#1\relax%
+ \expandafter\edef\pgfmath@base@macro{\the\c@pgfmath@countb}%
+ \let\pgfmath@next=\pgfmathbasetodec@@@@%
+ \else%
+ \chardef\pgfmath@charnum`#1\relax%
+ \c@pgfmath@countc=\pgfmath@charnum\relax%
+ \ifnum\c@pgfmath@countc>96\relax%
+ \advance\c@pgfmath@countc by-87\relax%
+ \else
+ \ifnum\c@pgfmath@countc>64\relax%
+ \advance\c@pgfmath@countc by-55\relax%
+ \else
+ \advance\c@pgfmath@countc by-48\relax%
+ \fi%
+ \fi%
+ \ifnum\c@pgfmath@countc<\pgfmath@base\relax%
+ \multiply\c@pgfmath@countc by\c@pgfmath@counta%
+ \advance\c@pgfmath@countb by\c@pgfmath@countc%
+ \divide\c@pgfmath@counta by\pgfmath@base\relax%
+ \let\pgfmath@next\pgfmathbasetodec@@@%
+ \else
+ \pgfmath@error{Digit `#1' invalid for base \pgfmath@base}%
+ \let\pgfmath@next=\relax%
+ \fi%
+ \fi%
+ \pgfmath@next}
\def\pgfmathbasetodec@@@@{%
- \expandafter\pgfmath@ensurenumberlength\expandafter{\pgfmath@base@macro}%
+ \expandafter\pgfmath@ensurenumberlength\expandafter{\pgfmath@base@macro}%
}
% \pgfmathdectobase
%
-% Convert a representation of an integer from
-% base 10 to the spcified base. Letters for bases
+% Convert a representation of an integer from
+% base 10 to the specified base. Letters for bases
% greater than 10 are in lowercase.
%
% #1 - a macro to store the result.
@@ -135,25 +135,25 @@
% \mynumber <- 7f
%
\def\pgfmathdectobase#1#2#3{%
- \pgfmath@checknumber{#2}%
- \pgfmath@checkbase{#3}%
- \c@pgfmath@counta=#2\relax%
- \let#1=\pgfmath@empty%
- \pgfmathloop
- \ifnum\c@pgfmath@counta>0\relax%
- \c@pgfmath@countb=\c@pgfmath@counta%
- \divide\c@pgfmath@countb by#3\relax%
- \multiply\c@pgfmath@countb by-#3\relax%
- \advance\c@pgfmath@countb by\c@pgfmath@counta%
- \edef#1{\csname pgfmath@lowercase digit@\the\c@pgfmath@countb\endcsname#1}%
- \divide\c@pgfmath@counta by#3\relax%
- \repeatpgfmathloop%
- \pgfmath@ensurenumberlength{#1}}
+ \pgfmath@checknumber{#2}%
+ \pgfmath@checkbase{#3}%
+ \c@pgfmath@counta=#2\relax%
+ \let#1=\pgfmath@empty%
+ \pgfmathloop
+ \ifnum\c@pgfmath@counta>0\relax%
+ \c@pgfmath@countb=\c@pgfmath@counta%
+ \divide\c@pgfmath@countb by#3\relax%
+ \multiply\c@pgfmath@countb by-#3\relax%
+ \advance\c@pgfmath@countb by\c@pgfmath@counta%
+ \edef#1{\csname pgfmath@lowercase digit@\the\c@pgfmath@countb\endcsname#1}%
+ \divide\c@pgfmath@counta by#3\relax%
+ \repeatpgfmathloop%
+ \pgfmath@ensurenumberlength{#1}}
% \pgfmathdectoBase
%
-% Convert a representation of an integer from
-% base 10 to the spcified base. Letters for bases
+% Convert a representation of an integer from
+% base 10 to the specified base. Letters for bases
% greater than 10 are in uppercase.
%
% #1 - a macro to store the result.
@@ -165,45 +165,45 @@
% \pgfmathdectoBase\mynumber{127}{16}
%
% \mynumber <- 7F
-%
+%
\def\pgfmathdectoBase#1#2#3{%
- \pgfmath@checkbase{#3}%
- \pgfmath@checknumber{#2}%
- \c@pgfmath@counta=#2\relax%
- \let#1=\pgfmath@empty%
- \pgfmathloop
- \ifnum\c@pgfmath@counta>0\relax%
- \c@pgfmath@countb=\c@pgfmath@counta%
- \divide\c@pgfmath@countb by#3\relax%
- \multiply\c@pgfmath@countb by-#3\relax%
- \advance\c@pgfmath@countb by\c@pgfmath@counta%
- \edef#1{\csname pgfmath@uppercase digit@\the\c@pgfmath@countb\endcsname#1}%
- \divide\c@pgfmath@counta by#3\relax%
- \repeatpgfmathloop%
- \pgfmath@ensurenumberlength{#1}}
+ \pgfmath@checkbase{#3}%
+ \pgfmath@checknumber{#2}%
+ \c@pgfmath@counta=#2\relax%
+ \let#1=\pgfmath@empty%
+ \pgfmathloop
+ \ifnum\c@pgfmath@counta>0\relax%
+ \c@pgfmath@countb=\c@pgfmath@counta%
+ \divide\c@pgfmath@countb by#3\relax%
+ \multiply\c@pgfmath@countb by-#3\relax%
+ \advance\c@pgfmath@countb by\c@pgfmath@counta%
+ \edef#1{\csname pgfmath@uppercase digit@\the\c@pgfmath@countb\endcsname#1}%
+ \divide\c@pgfmath@counta by#3\relax%
+ \repeatpgfmathloop%
+ \pgfmath@ensurenumberlength{#1}}
\def\pgfmath@base@digits@create{%
- \def\pgfmath@base@digit@style{lowercase digit}%
- \c@pgfmath@counta=0\relax%
- \pgfmath@base@digits@create@0123456789abcdefghijklmnopqrstuvwxyz\pgfmath@base@digits@create%
- \def\pgfmath@base@digit@style{uppercase digit}%
- \c@pgfmath@counta=0\relax%
- \pgfmath@base@digits@create@0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ\pgfmath@base@digits@create}
+ \def\pgfmath@base@digit@style{lowercase digit}%
+ \c@pgfmath@counta=0\relax%
+ \pgfmath@base@digits@create@0123456789abcdefghijklmnopqrstuvwxyz\pgfmath@base@digits@create%
+ \def\pgfmath@base@digit@style{uppercase digit}%
+ \c@pgfmath@counta=0\relax%
+ \pgfmath@base@digits@create@0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ\pgfmath@base@digits@create}
\def\pgfmath@base@digits@create@#1{%
- \ifx\pgfmath@base@digits@create#1\relax%
- \else%
- \expandafter\pgfmath@def\expandafter{\pgfmath@base@digit@style}{\the\c@pgfmath@counta}{#1}%
- \advance\c@pgfmath@counta by1\relax%
- \expandafter\pgfmath@base@digits@create@%
- \fi}
+ \ifx\pgfmath@base@digits@create#1\relax%
+ \else%
+ \expandafter\pgfmath@def\expandafter{\pgfmath@base@digit@style}{\the\c@pgfmath@counta}{#1}%
+ \advance\c@pgfmath@counta by1\relax%
+ \expandafter\pgfmath@base@digits@create@%
+ \fi}
\pgfmath@base@digits@create
% \pgfmathbasetobase
%
-% Convert a representation of an integer from
+% Convert a representation of an integer from
% between the specified bases. Letters for target
-% bases greater than 10 are in lppercase.
+% bases greater than 10 are in uppercase.
%
% #1 - a macro to store the result.
% #2 - a number (in a macro, not a register)
@@ -215,15 +215,15 @@
% \pgfmathbasetobase\mynumber{4321}{5}{9}
%
% \mynumber <- 721
-%
+%
\def\pgfmathbasetobase#1#2#3#4{%
- \pgfmathbasetodec{\pgfmath@base@temp}{#2}{#3}%
- \pgfmathdectobase{#1}{\pgfmath@base@temp}{#4}%
+ \pgfmathbasetodec{\pgfmath@base@temp}{#2}{#3}%
+ \pgfmathdectobase{#1}{\pgfmath@base@temp}{#4}%
}
% \pgfmathbasetobase
%
-% Convert a representation of an integer from
+% Convert a representation of an integer from
% between the specified bases. Letters for target
% bases greater than 10 are in uppercase.
%
@@ -237,34 +237,34 @@
% \pgfmathbasetobase\mynumber{1234}{5}{12}
%
% \mynumber <- 142
-%
+%
\def\pgfmathbasetoBase#1#2#3#4{%
- \pgfmathbasetodec{\pgfmath@base@temp}{#2}{#3}%
- \pgfmathdectoBase{#1}{\pgfmath@base@temp}{#4}%
+ \pgfmathbasetodec{\pgfmath@base@temp}{#2}{#3}%
+ \pgfmathdectoBase{#1}{\pgfmath@base@temp}{#4}%
}
\def\pgfmath@checkbase#1{%
- \ifnum#1<2\relax%
- \pgfmath@error{Cannot process numbers in base `#1'.}%
- \else%
- \ifnum#1>36\relax%
- \pgfmath@error{Cannot process numbers in base `#1'.}%
- \fi%
- \fi}
-
+ \ifnum#1<2\relax%
+ \pgfmath@error{Cannot process numbers in base `#1'.}%
+ \else%
+ \ifnum#1>36\relax%
+ \pgfmath@error{Cannot process numbers in base `#1'.}%
+ \fi%
+ \fi}
+
\def\pgfmath@checknumber#1{%
- \expandafter\pgfmath@checknumber@#1\pgfmath@}
+ \expandafter\pgfmath@checknumber@#1\pgfmath@}
\def\pgfmath@checknumber@#1#2\pgfmath@{%
- \ifx#1-%
- \pgfmath@error{Cannot process negative numbers.}%
- \fi}
+ \ifx#1-%
+ \pgfmath@error{Cannot process negative numbers.}%
+ \fi}
% \pgfmath@ensurenumberlength
%
% Internal macro for making a representation of a number have
-% a specific length, byt prefixing zeros to the number.
+% a specific length, byte prefixing zeros to the number.
%
-% #1 - a macro contatining a representation of an integer.
+% #1 - a macro containing a representation of an integer.
% #2 - the number of digits to ensure.
%
% e.g.
@@ -277,55 +277,54 @@
% \foo <- 000007FF
%
\def\pgfmath@ensurenumberlength#1{%
- \def\pgfmath@base@tempa{#1}%
- \expandafter\c@pgfmath@counta\pgfmath@basenumberlength\relax%
- \expandafter\pgfmath@ensurenumberlength@#1\pgfmath@ensurenumberlength}
+ \def\pgfmath@base@tempa{#1}%
+ \expandafter\c@pgfmath@counta\pgfmath@basenumberlength\relax%
+ \expandafter\pgfmath@ensurenumberlength@#1\pgfmath@ensurenumberlength}
\def\pgfmath@ensurenumberlength@#1{%
- \ifx\pgfmath@ensurenumberlength#1\relax%
- \expandafter\pgfmath@ensurenumberlength@@%
- \else%
- \advance\c@pgfmath@counta by-1\relax%
- \expandafter\pgfmath@ensurenumberlength@
- \fi}
+ \ifx\pgfmath@ensurenumberlength#1\relax%
+ \expandafter\pgfmath@ensurenumberlength@@%
+ \else%
+ \advance\c@pgfmath@counta by-1\relax%
+ \expandafter\pgfmath@ensurenumberlength@
+ \fi}
\def\pgfmath@ensurenumberlength@@{%
- \edef\pgfmath@base@tempb{\pgfmath@base@tempa}%
- \pgfmath@ensurenumberlength@@@}
+ \edef\pgfmath@base@tempb{\pgfmath@base@tempa}%
+ \pgfmath@ensurenumberlength@@@}
\def\pgfmath@ensurenumberlength@@@{%
- \ifnum\c@pgfmath@counta>0\relax%
- \advance\c@pgfmath@counta by-1\relax%
- \edef\pgfmath@base@tempb{0\pgfmath@base@tempb}%
- \expandafter\pgfmath@ensurenumberlength@@@%
- \fi%
- \expandafter\edef\pgfmath@base@tempa{\pgfmath@base@tempb}}
-
+ \ifnum\c@pgfmath@counta>0\relax%
+ \advance\c@pgfmath@counta by-1\relax%
+ \edef\pgfmath@base@tempb{0\pgfmath@base@tempb}%
+ \expandafter\pgfmath@ensurenumberlength@@@%
+ \fi%
+ \expandafter\edef\pgfmath@base@tempa{\pgfmath@base@tempb}}
+
\def\pgfmathsetbasenumberlength#1{\def\pgfmath@basenumberlength{#1}}
\pgfmathsetbasenumberlength{1}%
% \pgfmathtodigitlist\marg{macro}\marg{number}}
%
-% This command converts \meta{number} into a comma-separated
-% list of digits and stores the result in \meta{macro}.
-% The \marg{number} is \emph{not} parsed before processing.
+% This command converts \meta{number} into a comma-separated
+% list of digits and stores the result in \meta{macro}.
+% The \marg{number} is \emph{not} parsed before processing.
%
\def\pgfmathtodigitlist#1#2{%
- \def\pgfmath@temp{#1}%
- \let\pgfmath@digitlist=\pgfutil@empty%
- \edef\pgfmath@@tmp{#2}%
- \expandafter\pgfmath@todigitlist\pgfmath@@tmp @%
+ \def\pgfmath@temp{#1}%
+ \let\pgfmath@digitlist=\pgfutil@empty%
+ \edef\pgfmath@@tmp{#2}%
+ \expandafter\pgfmath@todigitlist\pgfmath@@tmp @%
}
\def\pgfmath@base@atchar{@}
\def\pgfmath@todigitlist#1{%
- \def\pgfmath@digit{#1}%
- \ifx\pgfmath@digit\pgfmath@base@atchar%
- \expandafter\let\pgfmath@temp=\pgfmath@digitlist%
- \else%
- \ifx\pgfmath@digitlist\pgfutil@empty%
- \edef\pgfmath@digitlist{#1}%
- \else%
- \edef\pgfmath@digitlist{\pgfmath@digitlist,#1}%
- \fi%
- \expandafter\pgfmath@todigitlist%
- \fi%
+ \def\pgfmath@digit{#1}%
+ \ifx\pgfmath@digit\pgfmath@base@atchar%
+ \expandafter\let\pgfmath@temp=\pgfmath@digitlist%
+ \else%
+ \ifx\pgfmath@digitlist\pgfutil@empty%
+ \edef\pgfmath@digitlist{#1}%
+ \else%
+ \edef\pgfmath@digitlist{\pgfmath@digitlist,#1}%
+ \fi%
+ \expandafter\pgfmath@todigitlist%
+ \fi%
}
-
diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.basic.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.basic.code.tex
index b6ac16c8bf3..2dbf154d8be 100644
--- a/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.basic.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.basic.code.tex
@@ -14,7 +14,7 @@
% add function.
%
\pgfmathdeclarefunction{add}{2}{%
- \begingroup%
+ \begingroup%
\pgfmath@x=#1pt\relax%
\pgfmath@y=#2pt\relax%
\advance\pgfmath@x by\pgfmath@y%
@@ -26,7 +26,7 @@
% subtract function.
%
\pgfmathdeclarefunction{subtract}{2}{%
- \begingroup%
+ \begingroup%
\pgfmath@x=#1pt\relax%
\pgfmath@y=#2pt\relax%
\advance\pgfmath@x by-\pgfmath@y%
@@ -37,11 +37,11 @@
% neg function.
%
\pgfmathdeclarefunction{neg}{1}{%
- \begingroup%
- \pgfmath@x=-#1pt\relax%
- \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@x}}%
- \pgfmath@smuggleone\pgfmathresult%
- \endgroup%
+ \begingroup%
+ \pgfmath@x=-#1pt\relax%
+ \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@x}}%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
}
% change the precedence for neg.
% Otherwise, unary minus and exponentiation won't have the correct precedence
@@ -64,206 +64,206 @@
\newif\ifpgfmath@divide@period
\pgfmathdeclarefunction{divide}{2}{%
- \begingroup%
- \pgfmath@x=#1pt\relax%
- \pgfmath@y=#2pt\relax%
- \let\pgfmath@sign=\pgfmath@empty%
- \ifdim0pt=\pgfmath@y%
- \pgfmath@error{You've asked me to divide `#1' by `#2', %
- but I cannot divide any number by `#2'}%
- \fi%
- \afterassignment\pgfmath@xa%
- \c@pgfmath@counta\the\pgfmath@y\relax%
- \ifdim0pt=\pgfmath@xa%
- \divide\pgfmath@x by\c@pgfmath@counta%
- \else%
- \ifdim0pt>\pgfmath@x%
- \def\pgfmath@sign{-}%
- \pgfmath@x=-\pgfmath@x%
- \fi%
- \ifdim0pt>\pgfmath@y%
- \expandafter\def\expandafter\pgfmath@sign\expandafter{\pgfmath@sign-}%
- \pgfmath@y=-\pgfmath@y%
- \fi%
- \ifdim1pt>\pgfmath@y%
- \pgfmathreciprocal@{\pgfmath@tonumber{\pgfmath@y}}%
- \pgfmath@x=\pgfmath@sign\pgfmathresult\pgfmath@x%
- \else%
- \def\pgfmathresult{0}%
- \pgfmath@divide@periodtrue%
- \c@pgfmath@counta=0\relax%
- \pgfmathdivide@@%
- \pgfmath@x=\pgfmath@sign\pgfmathresult pt\relax%
- \fi%
- \fi%
- \pgfmath@returnone\pgfmath@x%
- \endgroup%
+ \begingroup%
+ \pgfmath@x=#1pt\relax%
+ \pgfmath@y=#2pt\relax%
+ \let\pgfmath@sign=\pgfmath@empty%
+ \ifdim0pt=\pgfmath@y%
+ \pgfmath@error{You've asked me to divide `#1' by `#2', %
+ but I cannot divide any number by `#2'}%
+ \fi%
+ \afterassignment\pgfmath@xa%
+ \c@pgfmath@counta\the\pgfmath@y\relax%
+ \ifdim0pt=\pgfmath@xa%
+ \divide\pgfmath@x by\c@pgfmath@counta%
+ \else%
+ \ifdim0pt>\pgfmath@x%
+ \def\pgfmath@sign{-}%
+ \pgfmath@x=-\pgfmath@x%
+ \fi%
+ \ifdim0pt>\pgfmath@y%
+ \expandafter\def\expandafter\pgfmath@sign\expandafter{\pgfmath@sign-}%
+ \pgfmath@y=-\pgfmath@y%
+ \fi%
+ \ifdim1pt>\pgfmath@y%
+ \pgfmathreciprocal@{\pgfmath@tonumber{\pgfmath@y}}%
+ \pgfmath@x=\pgfmath@sign\pgfmathresult\pgfmath@x%
+ \else%
+ \def\pgfmathresult{0}%
+ \pgfmath@divide@periodtrue%
+ \c@pgfmath@counta=0\relax%
+ \pgfmathdivide@@%
+ \pgfmath@x=\pgfmath@sign\pgfmathresult pt\relax%
+ \fi%
+ \fi%
+ \pgfmath@returnone\pgfmath@x%
+ \endgroup%
}
\def\pgfmath@small@number{0.00002}
\def\pgfmathdivide@@{%
- \let\pgfmath@next=\relax%
- \ifdim\pgfmath@small@number pt<\pgfmath@x%
- \ifdim\pgfmath@small@number pt<\pgfmath@y%
- \ifdim\pgfmath@y>\pgfmath@x%
- \ifpgfmath@divide@period%
- \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult.}%
- \pgfmath@divide@periodfalse%
- \fi%
- \pgfmathdivide@dimenbyten\pgfmath@y%
- \ifdim\pgfmath@y>\pgfmath@x%
- \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult0}%
- \fi%
- \else%
- \c@pgfmath@counta=\pgfmath@x%
- \c@pgfmath@countb=\pgfmath@y%
- \divide\c@pgfmath@counta by\c@pgfmath@countb%
- \pgfmath@ya=\c@pgfmath@counta\pgfmath@y%
- \advance\pgfmath@x by-\pgfmath@ya%
- \def\pgfmath@next{%
- \toks0=\expandafter{\pgfmathresult}%
- \edef\pgfmathresult{\the\toks0 \the\c@pgfmath@counta}%
- }%
- \ifpgfmath@divide@period
- \else
- % we are behind the period. It may happen that the
- % result is more than one digit - in that case,
- % introduce special handling:
- \ifnum\c@pgfmath@counta>9 %
- \expandafter\pgfmathdivide@advance@last@digit\pgfmathresult CCCCC\@@
- \advance\c@pgfmath@counta by-10 %
- \ifnum\c@pgfmath@counta=0
- \let\pgfmath@next=\relax
- \fi
- \fi
- \fi
- \pgfmath@next
- \fi%
- \let\pgfmath@next=\pgfmathdivide@@%
- \fi%
- \fi%
- \pgfmath@next%
+ \let\pgfmath@next=\relax%
+ \ifdim\pgfmath@small@number pt<\pgfmath@x%
+ \ifdim\pgfmath@small@number pt<\pgfmath@y%
+ \ifdim\pgfmath@y>\pgfmath@x%
+ \ifpgfmath@divide@period%
+ \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult.}%
+ \pgfmath@divide@periodfalse%
+ \fi%
+ \pgfmathdivide@dimenbyten\pgfmath@y%
+ \ifdim\pgfmath@y>\pgfmath@x%
+ \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult0}%
+ \fi%
+ \else%
+ \c@pgfmath@counta=\pgfmath@x%
+ \c@pgfmath@countb=\pgfmath@y%
+ \divide\c@pgfmath@counta by\c@pgfmath@countb%
+ \pgfmath@ya=\c@pgfmath@counta\pgfmath@y%
+ \advance\pgfmath@x by-\pgfmath@ya%
+ \def\pgfmath@next{%
+ \toks0=\expandafter{\pgfmathresult}%
+ \edef\pgfmathresult{\the\toks0 \the\c@pgfmath@counta}%
+ }%
+ \ifpgfmath@divide@period
+ \else
+ % we are behind the period. It may happen that the
+ % result is more than one digit - in that case,
+ % introduce special handling:
+ \ifnum\c@pgfmath@counta>9 %
+ \expandafter\pgfmathdivide@advance@last@digit\pgfmathresult CCCCC\@@
+ \advance\c@pgfmath@counta by-10 %
+ \ifnum\c@pgfmath@counta=0
+ \let\pgfmath@next=\relax
+ \fi
+ \fi
+ \fi
+ \pgfmath@next
+ \fi%
+ \let\pgfmath@next=\pgfmathdivide@@%
+ \fi%
+ \fi%
+ \pgfmath@next%
}
% advances the last digit found in the number. Any missing digits are
% supposed to be filled with 'C'.
\def\pgfmathdivide@advance@last@digit#1.#2#3#4#5#6#7\@@{%
- \pgfmath@ya=\pgfmathresult pt %
- \if#2C%
- \pgfmath@xa=1pt %
- \else
- \if#3C%
- \pgfmath@xa=0.1pt %
- \else
- \if#4C%
- \pgfmath@xa=0.01pt %
- \else
- \if#5C%
- \pgfmath@xa=0.001pt %
- \else
- \if#6C%
- \pgfmath@xa=0.0001pt %
- \else
- \pgfmath@xa=0.00001pt %
- \fi
- \fi
- \fi
- \fi
- \fi
- \advance\pgfmath@ya by\pgfmath@xa
- \edef\pgfmathresult{\pgfmath@tonumber@notrailingzero\pgfmath@ya}%
+ \pgfmath@ya=\pgfmathresult pt %
+ \if#2C%
+ \pgfmath@xa=1pt %
+ \else
+ \if#3C%
+ \pgfmath@xa=0.1pt %
+ \else
+ \if#4C%
+ \pgfmath@xa=0.01pt %
+ \else
+ \if#5C%
+ \pgfmath@xa=0.001pt %
+ \else
+ \if#6C%
+ \pgfmath@xa=0.0001pt %
+ \else
+ \pgfmath@xa=0.00001pt %
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \advance\pgfmath@ya by\pgfmath@xa
+ \edef\pgfmathresult{\pgfmath@tonumber@notrailingzero\pgfmath@ya}%
}%
{
\catcode`\p=12
\catcode`\t=12
\gdef\Pgf@geT@NO@TRAILING@ZERO#1.#2pt{%
- #1.%
- \ifnum#2=0 \else #2\fi
+ #1.%
+ \ifnum#2=0 \else #2\fi
}
}
\def\pgfmath@tonumber@notrailingzero#1{\expandafter\Pgf@geT@NO@TRAILING@ZERO\the#1}
\def\pgfmathdivide@dimenbyten#1{%
- \edef\pgfmath@temp{\pgfmath@tonumber{#1}}%
- \expandafter\pgfmathdivide@@dimenbyten\pgfmath@temp\@@#1\@@}
+ \edef\pgfmath@temp{\pgfmath@tonumber{#1}}%
+ \expandafter\pgfmathdivide@@dimenbyten\pgfmath@temp\@@#1\@@}
\def\pgfmathdivide@@dimenbyten#1.#2\@@#3\@@{%
- \pgfmath@tempcnta=#1\relax%
- \divide\pgfmath@tempcnta by10\relax%
- \pgfmath@tempcntb=\pgfmath@tempcnta%
- \multiply\pgfmath@tempcnta by-10\relax%
- \advance\pgfmath@tempcnta by#1\relax%
- #3=\the\pgfmath@tempcntb.\the\pgfmath@tempcnta#2pt\relax%
+ \pgfmath@tempcnta=#1\relax%
+ \divide\pgfmath@tempcnta by10\relax%
+ \pgfmath@tempcntb=\pgfmath@tempcnta%
+ \multiply\pgfmath@tempcnta by-10\relax%
+ \advance\pgfmath@tempcnta by#1\relax%
+ #3=\the\pgfmath@tempcntb.\the\pgfmath@tempcnta#2pt\relax%
}
% reciprocal function.
%
\pgfmathdeclarefunction{reciprocal}{1}{%
- \begingroup%
- \expandafter\pgfmath@x#1pt\relax%
- \ifdim\pgfmath@x=0pt\relax%
- \pgfmath@error{You asked me to calculate `1/#1', but I cannot divide any number by zero}{}%
- \fi%
- \edef\pgfmath@reciprocaltemp{\pgfmath@tonumber{\pgfmath@x}}%
- \expandafter\pgfmathreciprocal@@\pgfmath@reciprocaltemp0000000\pgfmath@}
+ \begingroup%
+ \expandafter\pgfmath@x#1pt\relax%
+ \ifdim\pgfmath@x=0pt\relax%
+ \pgfmath@error{You asked me to calculate `1/#1', but I cannot divide any number by zero}{}%
+ \fi%
+ \edef\pgfmath@reciprocaltemp{\pgfmath@tonumber{\pgfmath@x}}%
+ \expandafter\pgfmathreciprocal@@\pgfmath@reciprocaltemp0000000\pgfmath@}
\def\pgfmathreciprocal@@#1.#2#3#4#5#6#7\pgfmath@{%
- \c@pgfmath@counta#2#3#4#5#6\relax%
- % If the number is an integer, use TeX arithmatic.
- \ifnum\c@pgfmath@counta=0\relax%
- \pgfmath@x1pt\relax%
- \divide\pgfmath@x#1\relax%
- \else%
- \ifnum#1>100\relax%
- \c@pgfmath@counta#1#2#3#4\relax%
- \c@pgfmath@countb1000000000\relax%
- \divide\c@pgfmath@countb\c@pgfmath@counta%
- \c@pgfmath@counta\c@pgfmath@countb%
- \divide\c@pgfmath@counta10000\relax%
- \pgfmath@x\c@pgfmath@counta pt\relax%
- \multiply\c@pgfmath@counta-10000\relax%
- \advance\c@pgfmath@countb\c@pgfmath@counta%
- \pgfmath@y\c@pgfmath@countb pt\relax%
- \divide\pgfmath@y1000000\relax%
- \advance\pgfmath@x\pgfmath@y%
- \else%
- \c@pgfmath@counta#1#2#3#4#5#6\relax%
- \c@pgfmath@countb1000000000\relax%
- \divide\c@pgfmath@countb\c@pgfmath@counta%
- \c@pgfmath@counta\c@pgfmath@countb%
- \divide\c@pgfmath@counta10000\relax%
- \pgfmath@x\c@pgfmath@counta pt\relax%
- \multiply\c@pgfmath@counta-10000\relax%
- \advance\c@pgfmath@countb\c@pgfmath@counta%
- \pgfmath@y\c@pgfmath@countb pt\relax%
- \pgfmath@y.1\pgfmath@y% Yes! This way is more accurate. Go figure...
- \pgfmath@y.1\pgfmath@y%
- \pgfmath@y.1\pgfmath@y%
- \pgfmath@y.1\pgfmath@y%
- \advance\pgfmath@x\pgfmath@y%
- \fi%
- \fi%
- \pgfmath@returnone\pgfmath@x%
- \endgroup%
+ \c@pgfmath@counta#2#3#4#5#6\relax%
+ % If the number is an integer, use TeX arithmetic.
+ \ifnum\c@pgfmath@counta=0\relax%
+ \pgfmath@x1pt\relax%
+ \divide\pgfmath@x#1\relax%
+ \else%
+ \ifnum#1>100\relax%
+ \c@pgfmath@counta#1#2#3#4\relax%
+ \c@pgfmath@countb1000000000\relax%
+ \divide\c@pgfmath@countb\c@pgfmath@counta%
+ \c@pgfmath@counta\c@pgfmath@countb%
+ \divide\c@pgfmath@counta10000\relax%
+ \pgfmath@x\c@pgfmath@counta pt\relax%
+ \multiply\c@pgfmath@counta-10000\relax%
+ \advance\c@pgfmath@countb\c@pgfmath@counta%
+ \pgfmath@y\c@pgfmath@countb pt\relax%
+ \divide\pgfmath@y1000000\relax%
+ \advance\pgfmath@x\pgfmath@y%
+ \else%
+ \c@pgfmath@counta#1#2#3#4#5#6\relax%
+ \c@pgfmath@countb1000000000\relax%
+ \divide\c@pgfmath@countb\c@pgfmath@counta%
+ \c@pgfmath@counta\c@pgfmath@countb%
+ \divide\c@pgfmath@counta10000\relax%
+ \pgfmath@x\c@pgfmath@counta pt\relax%
+ \multiply\c@pgfmath@counta-10000\relax%
+ \advance\c@pgfmath@countb\c@pgfmath@counta%
+ \pgfmath@y\c@pgfmath@countb pt\relax%
+ \pgfmath@y.1\pgfmath@y% Yes! This way is more accurate. Go figure...
+ \pgfmath@y.1\pgfmath@y%
+ \pgfmath@y.1\pgfmath@y%
+ \pgfmath@y.1\pgfmath@y%
+ \advance\pgfmath@x\pgfmath@y%
+ \fi%
+ \fi%
+ \pgfmath@returnone\pgfmath@x%
+ \endgroup%
}
% div function.
%
\pgfmathdeclarefunction{div}{2}{%
- \begingroup%
- \pgfmathdivide@{#1}{#2}%
- \ifdim\pgfmathresult pt<0pt\relax%
- \pgfmathceil@{\pgfmathresult}%
- \else%
- \pgfmathfloor@{\pgfmathresult}%
- \fi%
- \afterassignment\pgfmath@gobbletilpgfmath@%
- \c@pgfmath@counta=\pgfmathresult\relax\pgfmath@%
- \edef\pgfmathresult{\the\c@pgfmath@counta}%
- \pgfmath@smuggleone\pgfmathresult%
- \endgroup%
+ \begingroup%
+ \pgfmathdivide@{#1}{#2}%
+ \ifdim\pgfmathresult pt<0pt\relax%
+ \pgfmathceil@{\pgfmathresult}%
+ \else%
+ \pgfmathfloor@{\pgfmathresult}%
+ \fi%
+ \afterassignment\pgfmath@gobbletilpgfmath@%
+ \c@pgfmath@counta=\pgfmathresult\relax\pgfmath@%
+ \edef\pgfmathresult{\the\c@pgfmath@counta}%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
}
% mod function.
@@ -285,27 +285,27 @@
% Mod function (never negative).
%
\pgfmathdeclarefunction{Mod}{2}{%
- \begingroup%
- \pgfmathmod@{#1}{#2}%
- \pgfmath@x=\pgfmathresult pt\relax%
- \ifdim\pgfmath@x<0pt\relax%
- \advance\pgfmath@x by#2pt\relax%
- \fi%
- \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@x}}%
- \pgfmath@smuggleone\pgfmathresult%
- \endgroup%
+ \begingroup%
+ \pgfmathmod@{#1}{#2}%
+ \pgfmath@x=\pgfmathresult pt\relax%
+ \ifdim\pgfmath@x<0pt\relax%
+ \advance\pgfmath@x by#2pt\relax%
+ \fi%
+ \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@x}}%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
}
% abs function.
%
\pgfmathdeclarefunction{abs}{1}{%
- \begingroup%
- \expandafter\pgfmath@x#1pt\relax%
- \ifdim\pgfmath@x<0pt\relax%
- \pgfmath@x-\pgfmath@x%
- \fi%
- \pgfmath@returnone\pgfmath@x%
- \endgroup%
+ \begingroup%
+ \expandafter\pgfmath@x#1pt\relax%
+ \ifdim\pgfmath@x<0pt\relax%
+ \pgfmath@x-\pgfmath@x%
+ \fi%
+ \pgfmath@returnone\pgfmath@x%
+ \endgroup%
}
% sign(x)
@@ -334,189 +334,189 @@
% uses coefficients contributed by Alain Matthes.
%
\pgfmathdeclarefunction{ln}{1}{%
- \begingroup%
- \expandafter\pgfmath@x#1pt\relax%
- \ifdim\pgfmath@x>0pt\else%
- \pgfmath@error{I cannot calculate the logarithm of `#1'}{}%
- \fi%
- \c@pgfmath@counta=0\relax%
- \ifdim\pgfmath@x>2pt\relax%
- \ifdim\pgfmath@x<128pt\relax%
- \ifdim\pgfmath@x<8pt\relax%
- \ifdim\pgfmath@x<4pt\relax%
- \divide\pgfmath@x by2\relax%
- \c@pgfmath@counta=1\relax%
- \else%
- \divide\pgfmath@x by4\relax%
- \c@pgfmath@counta=2\relax%
- \fi%
- \else%
- \ifdim\pgfmath@x<32pt\relax%
- \ifdim\pgfmath@x<16pt\relax%
- \divide\pgfmath@x by8\relax%
- \c@pgfmath@counta=3\relax%
- \else%
- \divide\pgfmath@x by16\relax%
- \c@pgfmath@counta=4\relax%
- \fi%
- \else%
- \ifdim\pgfmath@x<64pt\relax%
- \divide\pgfmath@x by32\relax%
- \c@pgfmath@counta=5\relax%
- \else%
- \divide\pgfmath@x by64\relax%
- \c@pgfmath@counta=6\relax%
- \fi%
- \fi%
- \fi%
- \else%
- \ifdim\pgfmath@x<2048pt\relax%
- \ifdim\pgfmath@x<512pt\relax%
- \ifdim\pgfmath@x<256pt\relax%
- \divide\pgfmath@x by128\relax%
- \c@pgfmath@counta=7\relax%
- \else%
- \divide\pgfmath@x by256\relax%
- \c@pgfmath@counta=8\relax%
- \fi%
- \else%
- \ifdim\pgfmath@x<1024pt\relax%
- \divide\pgfmath@x by512\relax%
- \c@pgfmath@counta=9\relax%
- \else%
- \divide\pgfmath@x by1024\relax%
- \c@pgfmath@counta=10\relax%
- \fi%
- \fi%
- \else%
- \ifdim\pgfmath@x<8192pt\relax%
- \ifdim\pgfmath@x<4096pt\relax%
- \divide\pgfmath@x by2048\relax%
- \c@pgfmath@counta=11\relax%
- \else%
- \divide\pgfmath@x by4096\relax%
- \c@pgfmath@counta =12\relax%
- \fi%
- \else%
- \divide\pgfmath@x by8192\relax%
- \c@pgfmath@counta=13\relax%
- \fi%
- \fi%
- \fi%
- \else%
- \ifdim\pgfmath@x<1pt\relax%
- \ifdim\pgfmath@x>0.0078125pt\relax% 2^-7
- \ifdim\pgfmath@x>0.125pt\relax% 2^-3
- \ifdim\pgfmath@x>0.5pt\relax% 2^-1
- \multiply\pgfmath@x by2\relax%
- \c@pgfmath@counta=-1\relax%
- \else%
- \multiply\pgfmath@x by4\relax%
- \c@pgfmath@counta=-2\relax%
- \fi%
- \else%
- \ifdim\pgfmath@x>0.03125pt\relax% 2^-5
- \ifdim\pgfmath@x>0.0625pt\relax%
- \multiply\pgfmath@x by8\relax%
- \c@pgfmath@counta=-3\relax%
- \else%
- \multiply\pgfmath@x by16\relax%
- \c@pgfmath@counta=-4\relax%
- \fi%
- \else%
- \ifdim\pgfmath@x>0.015625pt\relax% 2^-6
- \multiply\pgfmath@x by32\relax%
- \c@pgfmath@counta=-5\relax%
- \else%
- \multiply\pgfmath@x by64\relax%
- \c@pgfmath@counta=-6\relax%
- \fi%
- \fi%
- \fi%
- \else%
- \ifdim\pgfmath@x>0.000244140625pt\relax% 2^-11
- \ifdim\pgfmath@x>0.001953125pt\relax% 2^-9
- \ifdim\pgfmath@x>0.00390625pt\relax% 2^-8
- \multiply\pgfmath@x by128\relax%
- \c@pgfmath@counta=-7\relax%
- \else%
- \multiply\pgfmath@x by256\relax%
- \c@pgfmath@counta=-8\relax%
- \fi%
- \else%
- \ifdim\pgfmath@x>0.0009765625pt\relax% 2^-10
- \multiply\pgfmath@x by512\relax%
- \c@pgfmath@counta=-9\relax%
- \else%
- \multiply\pgfmath@x by1024\relax%
- \c@pgfmath@counta=-10\relax%
- \fi%
- \fi%
- \else%
- \ifdim\pgfmath@x>0.0001220703125pt\relax% 2^13
- \ifdim\pgfmath@x>0.0002441406256pt\relax% 2^12
- \multiply\pgfmath@x by2048\relax%
- \c@pgfmath@counta=-11\relax%
- \else%
- \multiply\pgfmath@x by4096\relax%
- \c@pgfmath@counta=-12\relax%
- \fi%
- \else%
- \multiply\pgfmath@x by8192\relax%
- \c@pgfmath@counta=-13\relax%
- \fi%
- \fi%
- \fi%
- \fi%
- \fi%
- %
- % Use A+(B+(C+(D+(E+F*x)*x)*x)*x)*x
- %
- % where:
- % A = -2.787927935
- % B = 5.047861502
- % C = -3.489886985
- % D = 1.589480044
- % E = -.4025153233
- % F = 0.04300521312
- %
- \edef\pgfmath@temp{\pgfmath@tonumber{\pgfmath@x}}%
- \pgfmath@x=0.04300521312\pgfmath@x%
- \advance\pgfmath@x by-.4025153233pt\relax%
- \pgfmath@x=\pgfmath@temp\pgfmath@x%
- \advance\pgfmath@x by1.589480044pt\relax%
- \pgfmath@x=\pgfmath@temp\pgfmath@x%
- \advance\pgfmath@x by-3.489886985pt\relax%
- \pgfmath@x=\pgfmath@temp\pgfmath@x%
- \advance\pgfmath@x by5.047861502pt\relax%
- \pgfmath@x=\pgfmath@temp\pgfmath@x%
- \advance\pgfmath@x by-2.787927935pt\relax%
- \advance\pgfmath@x by\c@pgfmath@counta pt\relax%
- \pgfmath@x=0.6931471806\pgfmath@x%
- \pgfmath@returnone\pgfmath@x%
- \endgroup%
+ \begingroup%
+ \expandafter\pgfmath@x#1pt\relax%
+ \ifdim\pgfmath@x>0pt\else%
+ \pgfmath@error{I cannot calculate the logarithm of `#1'}{}%
+ \fi%
+ \c@pgfmath@counta=0\relax%
+ \ifdim\pgfmath@x>2pt\relax%
+ \ifdim\pgfmath@x<128pt\relax%
+ \ifdim\pgfmath@x<8pt\relax%
+ \ifdim\pgfmath@x<4pt\relax%
+ \divide\pgfmath@x by2\relax%
+ \c@pgfmath@counta=1\relax%
+ \else%
+ \divide\pgfmath@x by4\relax%
+ \c@pgfmath@counta=2\relax%
+ \fi%
+ \else%
+ \ifdim\pgfmath@x<32pt\relax%
+ \ifdim\pgfmath@x<16pt\relax%
+ \divide\pgfmath@x by8\relax%
+ \c@pgfmath@counta=3\relax%
+ \else%
+ \divide\pgfmath@x by16\relax%
+ \c@pgfmath@counta=4\relax%
+ \fi%
+ \else%
+ \ifdim\pgfmath@x<64pt\relax%
+ \divide\pgfmath@x by32\relax%
+ \c@pgfmath@counta=5\relax%
+ \else%
+ \divide\pgfmath@x by64\relax%
+ \c@pgfmath@counta=6\relax%
+ \fi%
+ \fi%
+ \fi%
+ \else%
+ \ifdim\pgfmath@x<2048pt\relax%
+ \ifdim\pgfmath@x<512pt\relax%
+ \ifdim\pgfmath@x<256pt\relax%
+ \divide\pgfmath@x by128\relax%
+ \c@pgfmath@counta=7\relax%
+ \else%
+ \divide\pgfmath@x by256\relax%
+ \c@pgfmath@counta=8\relax%
+ \fi%
+ \else%
+ \ifdim\pgfmath@x<1024pt\relax%
+ \divide\pgfmath@x by512\relax%
+ \c@pgfmath@counta=9\relax%
+ \else%
+ \divide\pgfmath@x by1024\relax%
+ \c@pgfmath@counta=10\relax%
+ \fi%
+ \fi%
+ \else%
+ \ifdim\pgfmath@x<8192pt\relax%
+ \ifdim\pgfmath@x<4096pt\relax%
+ \divide\pgfmath@x by2048\relax%
+ \c@pgfmath@counta=11\relax%
+ \else%
+ \divide\pgfmath@x by4096\relax%
+ \c@pgfmath@counta =12\relax%
+ \fi%
+ \else%
+ \divide\pgfmath@x by8192\relax%
+ \c@pgfmath@counta=13\relax%
+ \fi%
+ \fi%
+ \fi%
+ \else%
+ \ifdim\pgfmath@x<1pt\relax%
+ \ifdim\pgfmath@x>0.0078125pt\relax% 2^-7
+ \ifdim\pgfmath@x>0.125pt\relax% 2^-3
+ \ifdim\pgfmath@x>0.5pt\relax% 2^-1
+ \multiply\pgfmath@x by2\relax%
+ \c@pgfmath@counta=-1\relax%
+ \else%
+ \multiply\pgfmath@x by4\relax%
+ \c@pgfmath@counta=-2\relax%
+ \fi%
+ \else%
+ \ifdim\pgfmath@x>0.03125pt\relax% 2^-5
+ \ifdim\pgfmath@x>0.0625pt\relax%
+ \multiply\pgfmath@x by8\relax%
+ \c@pgfmath@counta=-3\relax%
+ \else%
+ \multiply\pgfmath@x by16\relax%
+ \c@pgfmath@counta=-4\relax%
+ \fi%
+ \else%
+ \ifdim\pgfmath@x>0.015625pt\relax% 2^-6
+ \multiply\pgfmath@x by32\relax%
+ \c@pgfmath@counta=-5\relax%
+ \else%
+ \multiply\pgfmath@x by64\relax%
+ \c@pgfmath@counta=-6\relax%
+ \fi%
+ \fi%
+ \fi%
+ \else%
+ \ifdim\pgfmath@x>0.000244140625pt\relax% 2^-11
+ \ifdim\pgfmath@x>0.001953125pt\relax% 2^-9
+ \ifdim\pgfmath@x>0.00390625pt\relax% 2^-8
+ \multiply\pgfmath@x by128\relax%
+ \c@pgfmath@counta=-7\relax%
+ \else%
+ \multiply\pgfmath@x by256\relax%
+ \c@pgfmath@counta=-8\relax%
+ \fi%
+ \else%
+ \ifdim\pgfmath@x>0.0009765625pt\relax% 2^-10
+ \multiply\pgfmath@x by512\relax%
+ \c@pgfmath@counta=-9\relax%
+ \else%
+ \multiply\pgfmath@x by1024\relax%
+ \c@pgfmath@counta=-10\relax%
+ \fi%
+ \fi%
+ \else%
+ \ifdim\pgfmath@x>0.0001220703125pt\relax% 2^13
+ \ifdim\pgfmath@x>0.0002441406256pt\relax% 2^12
+ \multiply\pgfmath@x by2048\relax%
+ \c@pgfmath@counta=-11\relax%
+ \else%
+ \multiply\pgfmath@x by4096\relax%
+ \c@pgfmath@counta=-12\relax%
+ \fi%
+ \else%
+ \multiply\pgfmath@x by8192\relax%
+ \c@pgfmath@counta=-13\relax%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ %
+ % Use A+(B+(C+(D+(E+F*x)*x)*x)*x)*x
+ %
+ % where:
+ % A = -2.787927935
+ % B = 5.047861502
+ % C = -3.489886985
+ % D = 1.589480044
+ % E = -.4025153233
+ % F = 0.04300521312
+ %
+ \edef\pgfmath@temp{\pgfmath@tonumber{\pgfmath@x}}%
+ \pgfmath@x=0.04300521312\pgfmath@x%
+ \advance\pgfmath@x by-.4025153233pt\relax%
+ \pgfmath@x=\pgfmath@temp\pgfmath@x%
+ \advance\pgfmath@x by1.589480044pt\relax%
+ \pgfmath@x=\pgfmath@temp\pgfmath@x%
+ \advance\pgfmath@x by-3.489886985pt\relax%
+ \pgfmath@x=\pgfmath@temp\pgfmath@x%
+ \advance\pgfmath@x by5.047861502pt\relax%
+ \pgfmath@x=\pgfmath@temp\pgfmath@x%
+ \advance\pgfmath@x by-2.787927935pt\relax%
+ \advance\pgfmath@x by\c@pgfmath@counta pt\relax%
+ \pgfmath@x=0.6931471806\pgfmath@x%
+ \pgfmath@returnone\pgfmath@x%
+ \endgroup%
}
% log2 function.
%
\pgfmathdeclarefunction{log2}{1}{%
- \begingroup%
- \pgfmathln@{#1}%
- \pgfmath@x=\pgfmathresult pt\relax%
- \pgfmath@x=1.442695041\pgfmath@x% 1/ln(2).
- \pgfmath@returnone\pgfmath@x%
- \endgroup%
+ \begingroup%
+ \pgfmathln@{#1}%
+ \pgfmath@x=\pgfmathresult pt\relax%
+ \pgfmath@x=1.442695041\pgfmath@x% 1/ln(2).
+ \pgfmath@returnone\pgfmath@x%
+ \endgroup%
}
% log10 function
%
-\pgfmathdeclarefunction{log10}{1}{%
- \begingroup%
- \pgfmathln@{#1}%
- \pgfmath@x=\pgfmathresult pt\relax%
- \pgfmath@x=0.43429441\pgfmath@x% 1/ln(10).
- \pgfmath@returnone\pgfmath@x%
- \endgroup%
+\pgfmathdeclarefunction{log10}{1}{%
+ \begingroup%
+ \pgfmathln@{#1}%
+ \pgfmath@x=\pgfmathresult pt\relax%
+ \pgfmath@x=0.43429441\pgfmath@x% 1/ln(10).
+ \pgfmath@returnone\pgfmath@x%
+ \endgroup%
}
% This is needed since \pgfmathlog2 and \pgfmathlog10 are not legal macro names
@@ -527,7 +527,7 @@
% exp function.
%
-\pgfmathdeclarefunction{exp}{1}{%
+\pgfmathdeclarefunction{exp}{1}{%
\begingroup
\pgfmath@xc=#1pt\relax
\pgfmath@yc=#1pt\relax
@@ -559,186 +559,186 @@
% sqrt function.
%
-\pgfmathdeclarefunction{sqrt}{1}{%
- \begingroup%
- \expandafter\pgfmath@x#1pt\relax%
- \ifdim\pgfmath@x<0pt\relax%
- \pgfmath@error{I cannot calculate the square-root of the negative number `#1'}{}%
- \else%
- \ifdim\pgfmath@x<10pt\relax%
- \def\pgfmath@zeros{0}%
- \def\pgfmath@targetiterations{1}%
- \else%
- \ifdim\pgfmath@x<100pt\relax%
- \def\pgfmath@zeros{}%
- \def\pgfmath@targetiterations{1}%
- \else%
- \ifdim\pgfmath@x<1000pt\relax%
- \def\pgfmath@zeros{0}%
- \def\pgfmath@targetiterations{2}%
- \else%
- \ifdim\pgfmath@x<10000pt\relax%
- \def\pgfmath@zeros{}%
- \def\pgfmath@targetiterations{2}%
- \else%
- \def\pgfmath@zeros{0}%
- \def\pgfmath@targetiterations{3}%
- \fi\fi\fi\fi\fi%
- \edef\pgfmath@temp{\pgfmath@zeros\pgfmath@tonumber{\pgfmath@x}}%
- \expandafter\pgfmath@sqrt@\pgfmath@temp\pgfmath@%
+\pgfmathdeclarefunction{sqrt}{1}{%
+ \begingroup%
+ \expandafter\pgfmath@x#1pt\relax%
+ \ifdim\pgfmath@x<0pt\relax%
+ \pgfmath@error{I cannot calculate the square-root of the negative number `#1'}{}%
+ \else%
+ \ifdim\pgfmath@x<10pt\relax%
+ \def\pgfmath@zeros{0}%
+ \def\pgfmath@targetiterations{1}%
+ \else%
+ \ifdim\pgfmath@x<100pt\relax%
+ \def\pgfmath@zeros{}%
+ \def\pgfmath@targetiterations{1}%
+ \else%
+ \ifdim\pgfmath@x<1000pt\relax%
+ \def\pgfmath@zeros{0}%
+ \def\pgfmath@targetiterations{2}%
+ \else%
+ \ifdim\pgfmath@x<10000pt\relax%
+ \def\pgfmath@zeros{}%
+ \def\pgfmath@targetiterations{2}%
+ \else%
+ \def\pgfmath@zeros{0}%
+ \def\pgfmath@targetiterations{3}%
+ \fi\fi\fi\fi\fi%
+ \edef\pgfmath@temp{\pgfmath@zeros\pgfmath@tonumber{\pgfmath@x}}%
+ \expandafter\pgfmath@sqrt@\pgfmath@temp\pgfmath@%
}
\def\pgfmath@sqrt@#1.#2\pgfmath@{\pgfmath@@sqrt@#1#2\pgfmath@empty\pgfmath@empty\pgfmath@}
\def\pgfmath@@sqrt@#1#2{%
- \c@pgfmath@countb=#1#2\relax%
- \ifnum\c@pgfmath@countb>35\relax%
- \ifnum\c@pgfmath@countb>63\relax%
- \ifnum\c@pgfmath@countb>80\relax%
- \c@pgfmath@counta=9\relax%
- \else%
- \c@pgfmath@counta=8\relax%
- \fi%
- \else%
- \ifnum\c@pgfmath@countb>48\relax%
- \c@pgfmath@counta=7\relax%
- \else%
- \c@pgfmath@counta=6\relax%
- \fi%
- \fi%
- \else%
- \ifnum\c@pgfmath@countb>15\relax%
- \ifnum\c@pgfmath@countb>24\relax%
- \c@pgfmath@counta5\relax%
- \else%
- \c@pgfmath@counta=4\relax%
- \fi%
- \else%
- \ifnum\c@pgfmath@countb>3\relax%
- \ifnum\c@pgfmath@countb>8\relax%
- \c@pgfmath@counta=3\relax%
- \else%
- \c@pgfmath@counta=2\relax%
- \fi%
- \else%
- \ifnum\c@pgfmath@countb>0\relax%
- \c@pgfmath@counta=1\relax%
- \else%
- \c@pgfmath@counta=0\relax%
- \fi%
- \fi%
- \fi%
- \fi%
- \edef\pgfmath@root{\the\c@pgfmath@counta}%
- \edef\pgfmath@rootspecial{\the\c@pgfmath@counta}%
- \multiply\c@pgfmath@counta by-\c@pgfmath@counta\relax%
- \advance\c@pgfmath@counta by#1#2\relax%
- \edef\pgfmath@remainder{\the\c@pgfmath@counta}%
- \pgfmath@@@sqrt@%
+ \c@pgfmath@countb=#1#2\relax%
+ \ifnum\c@pgfmath@countb>35\relax%
+ \ifnum\c@pgfmath@countb>63\relax%
+ \ifnum\c@pgfmath@countb>80\relax%
+ \c@pgfmath@counta=9\relax%
+ \else%
+ \c@pgfmath@counta=8\relax%
+ \fi%
+ \else%
+ \ifnum\c@pgfmath@countb>48\relax%
+ \c@pgfmath@counta=7\relax%
+ \else%
+ \c@pgfmath@counta=6\relax%
+ \fi%
+ \fi%
+ \else%
+ \ifnum\c@pgfmath@countb>15\relax%
+ \ifnum\c@pgfmath@countb>24\relax%
+ \c@pgfmath@counta5\relax%
+ \else%
+ \c@pgfmath@counta=4\relax%
+ \fi%
+ \else%
+ \ifnum\c@pgfmath@countb>3\relax%
+ \ifnum\c@pgfmath@countb>8\relax%
+ \c@pgfmath@counta=3\relax%
+ \else%
+ \c@pgfmath@counta=2\relax%
+ \fi%
+ \else%
+ \ifnum\c@pgfmath@countb>0\relax%
+ \c@pgfmath@counta=1\relax%
+ \else%
+ \c@pgfmath@counta=0\relax%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ \edef\pgfmath@root{\the\c@pgfmath@counta}%
+ \edef\pgfmath@rootspecial{\the\c@pgfmath@counta}%
+ \multiply\c@pgfmath@counta by-\c@pgfmath@counta\relax%
+ \advance\c@pgfmath@counta by#1#2\relax%
+ \edef\pgfmath@remainder{\the\c@pgfmath@counta}%
+ \pgfmath@@@sqrt@%
}
\def\pgfmath@@@sqrt@#1#2{%
- \ifx\pgfmath@empty#1%
- \edef\pgfmath@remainder{\pgfmath@remainder00}%
- \def\pgfmath@tokens{\pgfmath@empty\pgfmath@empty}%
- \else%
- \ifx\pgfmath@empty#2%
- \edef\pgfmath@remainder{\pgfmath@remainder#10}%
- \def\pgfmath@tokens{\pgfmath@empty\pgfmath@empty}%
- \else%
- \edef\pgfmath@remainder{\pgfmath@remainder#1#2}%
- \def\pgfmath@tokens{}%
- \fi\fi%
- \c@pgfmath@counta=\pgfmath@rootspecial\relax%
- \multiply\c@pgfmath@counta by20\relax%
- \c@pgfmath@countb=\c@pgfmath@counta%
- \multiply\c@pgfmath@countb by6\relax%
- \advance\c@pgfmath@countb by36\relax%
- \c@pgfmath@countc=\c@pgfmath@counta%
- \multiply\c@pgfmath@countc by2\relax%
- \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax%
- \advance\c@pgfmath@countb by-\c@pgfmath@countc%
- \advance\c@pgfmath@countb by-20\relax%
- \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax%
- \advance\c@pgfmath@countb by-\c@pgfmath@countc%
- \advance\c@pgfmath@countb by-12\relax%
- \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax%
- \advance\c@pgfmath@countb by-\c@pgfmath@counta%
- \advance\c@pgfmath@countb by-3\relax%
- \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax%
- \def\pgfmath@digit{0}%
- \else%
- \def\pgfmath@digit{1}%
- \fi%
- \else%
- \advance\c@pgfmath@countb by\c@pgfmath@counta%
- \advance\c@pgfmath@countb by5\relax%
- \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax%
- \def\pgfmath@digit{2}%
- \else%
- \def\pgfmath@digit{3}%
- \fi%
- \fi%
- \else%
- \advance\c@pgfmath@countb by\c@pgfmath@counta%
- \advance\c@pgfmath@countb by9\relax%
- \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax%
- \def\pgfmath@digit{4}%
- \else%
- \def\pgfmath@digit{5}%
- \fi%
- \fi%
- \else%
- \advance\c@pgfmath@countb by\c@pgfmath@countc%
- \advance\c@pgfmath@countb by28\relax%
- \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax%
- \advance\c@pgfmath@countb by-\c@pgfmath@counta%
- \advance\c@pgfmath@countb by-15\relax%
- \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax%
- \def\pgfmath@digit{6}%
- \else%
- \def\pgfmath@digit{7}%
- \fi%
- \else%
- \advance\c@pgfmath@countb by\c@pgfmath@counta%
- \advance\c@pgfmath@countb by17\relax%
- \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax%
- \def\pgfmath@digit{8}%
- \else%
- \def\pgfmath@digit{9}%
- \fi%
- \fi%
- \fi%
- \edef\pgfmath@rootspecial{\pgfmath@rootspecial\pgfmath@digit}%
- \advance\c@pgfmath@counta by\pgfmath@digit\relax%
- \multiply\c@pgfmath@counta by-\pgfmath@digit\relax%
- \advance\c@pgfmath@counta by\pgfmath@remainder\relax%
- \edef\pgfmath@remainder{\the\c@pgfmath@counta}%
- \c@pgfmath@counta=\pgfmath@targetiterations\relax%
- \advance\c@pgfmath@counta by-1\relax%
- \edef\pgfmath@targetiterations{\the\c@pgfmath@counta}%
- \ifnum\c@pgfmath@counta=0\relax%
- \edef\pgfmath@root{\pgfmath@root.\pgfmath@digit}%
- \else%
- \edef\pgfmath@root{\pgfmath@root\pgfmath@digit}%
- \fi%
- \ifnum\c@pgfmath@counta=-4\relax% -n+1 digits of precision.
- \let\pgfmath@next\pgfmath@sqrt@end%
- \else%
- \let\pgfmath@next\pgfmath@@@sqrt@%
- \fi%
- \expandafter\pgfmath@next\pgfmath@tokens%
+ \ifx\pgfmath@empty#1%
+ \edef\pgfmath@remainder{\pgfmath@remainder00}%
+ \def\pgfmath@tokens{\pgfmath@empty\pgfmath@empty}%
+ \else%
+ \ifx\pgfmath@empty#2%
+ \edef\pgfmath@remainder{\pgfmath@remainder#10}%
+ \def\pgfmath@tokens{\pgfmath@empty\pgfmath@empty}%
+ \else%
+ \edef\pgfmath@remainder{\pgfmath@remainder#1#2}%
+ \def\pgfmath@tokens{}%
+ \fi\fi%
+ \c@pgfmath@counta=\pgfmath@rootspecial\relax%
+ \multiply\c@pgfmath@counta by20\relax%
+ \c@pgfmath@countb=\c@pgfmath@counta%
+ \multiply\c@pgfmath@countb by6\relax%
+ \advance\c@pgfmath@countb by36\relax%
+ \c@pgfmath@countc=\c@pgfmath@counta%
+ \multiply\c@pgfmath@countc by2\relax%
+ \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax%
+ \advance\c@pgfmath@countb by-\c@pgfmath@countc%
+ \advance\c@pgfmath@countb by-20\relax%
+ \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax%
+ \advance\c@pgfmath@countb by-\c@pgfmath@countc%
+ \advance\c@pgfmath@countb by-12\relax%
+ \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax%
+ \advance\c@pgfmath@countb by-\c@pgfmath@counta%
+ \advance\c@pgfmath@countb by-3\relax%
+ \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax%
+ \def\pgfmath@digit{0}%
+ \else%
+ \def\pgfmath@digit{1}%
+ \fi%
+ \else%
+ \advance\c@pgfmath@countb by\c@pgfmath@counta%
+ \advance\c@pgfmath@countb by5\relax%
+ \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax%
+ \def\pgfmath@digit{2}%
+ \else%
+ \def\pgfmath@digit{3}%
+ \fi%
+ \fi%
+ \else%
+ \advance\c@pgfmath@countb by\c@pgfmath@counta%
+ \advance\c@pgfmath@countb by9\relax%
+ \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax%
+ \def\pgfmath@digit{4}%
+ \else%
+ \def\pgfmath@digit{5}%
+ \fi%
+ \fi%
+ \else%
+ \advance\c@pgfmath@countb by\c@pgfmath@countc%
+ \advance\c@pgfmath@countb by28\relax%
+ \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax%
+ \advance\c@pgfmath@countb by-\c@pgfmath@counta%
+ \advance\c@pgfmath@countb by-15\relax%
+ \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax%
+ \def\pgfmath@digit{6}%
+ \else%
+ \def\pgfmath@digit{7}%
+ \fi%
+ \else%
+ \advance\c@pgfmath@countb by\c@pgfmath@counta%
+ \advance\c@pgfmath@countb by17\relax%
+ \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax%
+ \def\pgfmath@digit{8}%
+ \else%
+ \def\pgfmath@digit{9}%
+ \fi%
+ \fi%
+ \fi%
+ \edef\pgfmath@rootspecial{\pgfmath@rootspecial\pgfmath@digit}%
+ \advance\c@pgfmath@counta by\pgfmath@digit\relax%
+ \multiply\c@pgfmath@counta by-\pgfmath@digit\relax%
+ \advance\c@pgfmath@counta by\pgfmath@remainder\relax%
+ \edef\pgfmath@remainder{\the\c@pgfmath@counta}%
+ \c@pgfmath@counta=\pgfmath@targetiterations\relax%
+ \advance\c@pgfmath@counta by-1\relax%
+ \edef\pgfmath@targetiterations{\the\c@pgfmath@counta}%
+ \ifnum\c@pgfmath@counta=0\relax%
+ \edef\pgfmath@root{\pgfmath@root.\pgfmath@digit}%
+ \else%
+ \edef\pgfmath@root{\pgfmath@root\pgfmath@digit}%
+ \fi%
+ \ifnum\c@pgfmath@counta=-4\relax% -n+1 digits of precision.
+ \let\pgfmath@next\pgfmath@sqrt@end%
+ \else%
+ \let\pgfmath@next\pgfmath@@@sqrt@%
+ \fi%
+ \expandafter\pgfmath@next\pgfmath@tokens%
}
\def\pgfmath@sqrt@end#1\pgfmath@{%
- \edef\pgfmathresult{\pgfmath@root}%
- \pgfmath@smuggleone\pgfmathresult%
- \endgroup}
+ \edef\pgfmathresult{\pgfmath@root}%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup}
% \pgfmathpow
%
% Calculates #1 ^ #2
%
-\pgfmathdeclarefunction{pow}{2}{%
+\pgfmathdeclarefunction{pow}{2}{%
\begingroup%
\pgfmath@xa=#1pt%
\pgfmath@xb=#2pt%
@@ -775,27 +775,27 @@
\pgfmathexp@{\pgfmath@tonumber{\pgfmath@x}}%
\pgfmath@x=\pgfmathresult pt\relax%
\fi%
- \fi
+ \fi
\pgfmath@returnone\pgf@x%
\endgroup%
}
% factorial function.
%
-\pgfmathdeclarefunction{factorial}{1}{%
- \begingroup%
- \afterassignment\pgfmath@gobbletilpgfmath@%
- \c@pgfmath@counta=#1\relax\pgfmath@%
- \pgfmath@x=1pt\relax%
- \pgfmathloop%
- \ifnum\c@pgfmath@counta<2\relax%
- \else%
- \multiply\pgfmath@x by\c@pgfmath@counta%
- \advance\c@pgfmath@counta by-1\relax%
- \repeatpgfmathloop%
- \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@x}}%
- \pgfmath@smuggleone\pgfmathresult%
- \endgroup%
+\pgfmathdeclarefunction{factorial}{1}{%
+ \begingroup%
+ \afterassignment\pgfmath@gobbletilpgfmath@%
+ \c@pgfmath@counta=#1\relax\pgfmath@%
+ \pgfmath@x=1pt\relax%
+ \pgfmathloop%
+ \ifnum\c@pgfmath@counta<2\relax%
+ \else%
+ \multiply\pgfmath@x by\c@pgfmath@counta%
+ \advance\c@pgfmath@counta by-1\relax%
+ \repeatpgfmathloop%
+ \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@x}}%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
}
% Local Variables:
diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.code.tex
index b35e3d2595b..d1c3c43443e 100644
--- a/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.code.tex
@@ -15,45 +15,49 @@
%
% Use \pgfmathdeclarefunction* to force a redefinition if the function exists already.
\def\pgfmathdeclarefunction{\pgfmath@ifnextchar*\pgfmathdeclarefunction@force\pgfmathdeclarefunction@check}
-\def\pgfmathdeclarefunction@check#1#2#3{%
- \expandafter\ifx\csname pgfmath@function@#1\endcsname\relax%
- \pgfmath@declarefunction{#1}{#2}{#3}%
- \else%
- \pgfmath@error{The function `#1' already exists}{}%
- \fi%
+\def\pgfmathdeclarefunction@check#1{%
+ \expandafter\ifx\csname pgfmath@function@#1\endcsname\relax\else%
+ \pgfmath@error{The function `#1' already exists}{}%
+ \fi%
+ \pgfmath@declarefunction{#1}%
}
\def\pgfmathdeclarefunction@force*{\pgfmath@declarefunction}%
\def\pgfmathredeclarefunction#1#2{%
- \expandafter\ifx\csname pgfmath@function@#1\endcsname\relax%
- \pgfmath@error{The function `#1' does not exist}{}%
- \else%
+ \expandafter\ifx\csname pgfmath@function@#1\endcsname\relax%
+ \pgfmath@error{The function `#1' does not exist}{}%
+ \else%
% was: \pgfmath@namedef{pgfmath#1@}{#2}% TT
- \edef\pgf@marshal{\noexpand\pgfmathdeclarefunction*{#1}{\csname pgfmath@operation@#1@arity\endcsname}}%
+ \edef\pgf@marshal{\noexpand\pgfmathdeclarefunction*{#1}{\csname pgfmath@operation@#1@arity\endcsname}}%
\pgf@marshal{#2}%
- \fi%
+ \fi%
}
\def\pgfmath@declarefunction#1#2{%
- \pgfmath@namedef{pgfmath@function@#1}{#1}%
- \pgfmath@namedef{pgfmath@operation@#1@type}{function}%
- \pgfmath@namedef{pgfmath@operation@#1@arity}{#2}%
- \pgfmath@namedef{pgfmath@operation@#1@infix}{#1}%
- \pgfmath@namedef{pgfmath@operation@#1@precedence}{1000}%
- \expandafter\ifx\csname pgfmath@operation@#1@arity\endcsname\pgfmath@dots%
- \pgfmath@namedef{pgfmath@operation@#1@arity}{1}%
- \else%
- \ifnum\csname pgfmath@operation@#1@arity\endcsname>9\relax%
- \pgfmath@namedef{pgfmath@operation@#1@arity}{1}%
- \fi%
- \fi%
- \edef\pgfmath@marshal{%
- \noexpand\pgfmath@@declarefunction%
- {\expandafter\noexpand\csname pgfmath#1\endcsname}%
- {\expandafter\noexpand\csname pgfmath#1@\endcsname}%
- {\csname pgfmath@operation@#1@arity\endcsname}%
- }%
- \pgfmath@marshal%
+ \pgfmath@namedef{pgfmath@function@#1}{#1}%
+ \pgfmath@namedef{pgfmath@operation@#1@type}{function}%
+ \pgfmath@namedef{pgfmath@operation@#1@arity}{#2}%
+ \pgfmath@namedef{pgfmath@operation@#1@infix}{#1}%
+ \pgfmath@namedef{pgfmath@operation@#1@precedence}{1000}%
+ \expandafter\ifx\csname pgfmath@operation@#1@arity\endcsname\pgfmath@dots%
+ \pgfmath@namedef{pgfmath@operation@#1@arity}{1}%
+ \else%
+ \ifnum\csname pgfmath@operation@#1@arity\endcsname>9\relax%
+ \pgfmath@namedef{pgfmath@operation@#1@arity}{1}%
+ \fi%
+ \fi%
+ \edef\pgfmath@marshal{%
+ \noexpand\pgfmath@@declarefunction%
+ {\expandafter\noexpand\csname pgfmath#1\endcsname}%
+ {\expandafter\noexpand\csname pgfmath#1@\endcsname}%
+ {\csname pgfmath@operation@#1@arity\endcsname}%
+ }%
+ \begingroup%
+ \catcode`\^^I=9\relax%
+ \catcode`\ =9\relax%
+ \catcode`\~=10\relax%
+ \endlinechar=`\ \relax
+ \pgfmath@marshal%
}
% #1 - \pgfmath<name>.
@@ -62,115 +66,116 @@
% #4 - code for function <name>.
%
\def\pgfmath@@declarefunction#1#2#3#4{% Function of arity 0 - 9.
- \ifcase#3\relax%
- \def#1{#2}%
- \def#2{#4}%
- \or
- \def#1##1{\pgfmathparse{##1}\expandafter#2\expandafter{\pgfmathresult}}%
- \def#2##1{#4}%
- \else%
- \pgfmath@toks={}%
- \pgfmathloop%
- \ifnum\pgfmathcounter>#3\relax%
- \else%
- \expandafter\pgfmath@addto@toks\expandafter{\pgfmath@char@hash}%
- \expandafter\pgfmath@addto@toks\expandafter{\pgfmathcounter}%
- \repeatpgfmathloop%
- \edef\pgfmath@head{\noexpand\def\noexpand#1\the\pgfmath@toks}%
- \edef\pgfmath@@head{\noexpand\def\noexpand#2\the\pgfmath@toks}%
- \pgfmath@toks={}%
- \def\pgfmath@arguments{}%
- \pgfmathloop%
- \ifnum\pgfmathcounter>#3\relax%
- \else%
- \pgfmath@addto@toks{\pgfmathparse}%
- \expandafter\expandafter\expandafter\pgfmath@addto@toks%
- \expandafter\expandafter\expandafter{\expandafter\expandafter\expandafter%
- {\expandafter\pgfmath@char@hash\pgfmathcounter}}%
- \pgfmath@addto@toks{\let}%
- \expandafter\pgfmath@addto@toks\expandafter{%
- \csname pgfmath@argument@\pgfmathcounter\endcsname=\pgfmathresult}%
- \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter%
- \pgfmath@arguments\expandafter\expandafter\expandafter{\expandafter%
- \pgfmath@arguments\expandafter{\csname pgfmath@argument@\pgfmathcounter\endcsname}}%
- \repeatpgfmathloop%
- \expandafter\pgfmath@addto@toks\expandafter{\expandafter#2\pgfmath@arguments}%
- \edef\pgfmath@body{{\the\pgfmath@toks}}%
- \expandafter\pgfmath@head\pgfmath@body%
- \pgfmath@@head{#4}%
- \fi%
+ \endgroup%
+ \ifcase#3\relax%
+ \def#1{#2}%
+ \def\pgfmath@@head{\def#2}%
+ \or
+ \def#1##1{\pgfmathparse{##1}\expandafter#2\expandafter{\pgfmathresult}}%
+ \def\pgfmath@@head{\def#2####1}%
+ \else%
+ \pgfmath@toks={}%
+ \pgfmathloop%
+ \ifnum\pgfmathcounter>#3\relax%
+ \else%
+ \expandafter\pgfmath@addto@toks\expandafter{\pgfmath@char@hash}%
+ \expandafter\pgfmath@addto@toks\expandafter{\pgfmathcounter}%
+ \repeatpgfmathloop%
+ \edef\pgfmath@head{\noexpand\def\noexpand#1\the\pgfmath@toks}%
+ \edef\pgfmath@@head{\noexpand\def\noexpand#2\the\pgfmath@toks}%
+ \pgfmath@toks={}%
+ \def\pgfmath@arguments{}%
+ \pgfmathloop%
+ \ifnum\pgfmathcounter>#3\relax%
+ \else%
+ \pgfmath@addto@toks{\pgfmathparse}%
+ \expandafter\expandafter\expandafter\pgfmath@addto@toks%
+ \expandafter\expandafter\expandafter{\expandafter\expandafter\expandafter%
+ {\expandafter\pgfmath@char@hash\pgfmathcounter}}%
+ \pgfmath@addto@toks{\let}%
+ \expandafter\pgfmath@addto@toks\expandafter{%
+ \csname pgfmath@argument@\pgfmathcounter\endcsname=\pgfmathresult}%
+ \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter%
+ \pgfmath@arguments\expandafter\expandafter\expandafter{\expandafter%
+ \pgfmath@arguments\expandafter{\csname pgfmath@argument@\pgfmathcounter\endcsname}}%
+ \repeatpgfmathloop%
+ \expandafter\pgfmath@addto@toks\expandafter{\expandafter#2\pgfmath@arguments}%
+ \edef\pgfmath@body{{\the\pgfmath@toks}}%
+ \expandafter\pgfmath@head\pgfmath@body%
+ \fi%
+ \pgfmath@@head{#4}%
}
\def\pgfmath@addto@toks#1{%
- \edef\pgfmath@toks@expanded{\the\pgfmath@toks}%
- \expandafter\pgfmath@toks\expandafter{\pgfmath@toks@expanded#1}}
+ \edef\pgfmath@toks@expanded{\the\pgfmath@toks}%
+ \expandafter\pgfmath@toks\expandafter{\pgfmath@toks@expanded#1}}
% Key for declaring local functions.
%
\pgfkeys{%
- /pgf/declare function/.code={%
- \pgfmath@local@functions#1@=@;%
- }
+ /pgf/declare function/.code={%
+ \pgfmath@local@functions#1@=@;%
+ }
}
\def\pgfmath@local@gobbleone#1{}
\def\pgfmath@local@at{@}%
\def\pgfmath@local@functions{%
- \pgfutil@ifnextchar x{\pgfmath@local@@functions}{\pgfmath@local@@functions}%
+ \pgfutil@ifnextchar x{\pgfmath@local@@functions}{\pgfmath@local@@functions}%
}
\def\pgfmath@local@@functions#1=#2;{%
- \def\pgfmath@local@temp{#1}%
- \ifx\pgfmath@local@temp\pgfmath@local@at%
- \let\pgfmath@local@next=\relax%
- \else%
- \pgfmath@local@function#1=#2;%
- \let\pgfmath@local@next=\pgfmath@local@functions%
- \fi%
- \pgfmath@local@next%
+ \def\pgfmath@local@temp{#1}%
+ \ifx\pgfmath@local@temp\pgfmath@local@at%
+ \let\pgfmath@local@next=\relax%
+ \else%
+ \pgfmath@local@function#1=#2;%
+ \let\pgfmath@local@next=\pgfmath@local@functions%
+ \fi%
+ \pgfmath@local@next%
}
\def\pgfmath@local@function{%
- \let\pgfmath@local@name=\pgfutil@empty%
- \let\pgfmath@local@args=\pgfutil@empty%
- \let\pgfmath@local@body=\pgfutil@empty%
- \pgfmath@local@@function}
+ \let\pgfmath@local@name=\pgfutil@empty%
+ \let\pgfmath@local@args=\pgfutil@empty%
+ \let\pgfmath@local@body=\pgfutil@empty%
+ \pgfmath@local@@function}
\def\pgfmath@local@@function#1{%
- \if#1=%
- \let\pgfmath@local@next=\pgfmath@local@function@body%
- \else%
- \if#1(%
- \let\pgfmath@local@next=\pgfmath@local@function@args%
- \else%
- \expandafter\def\expandafter\pgfmath@local@name\expandafter{\pgfmath@local@name#1}%
- \let\pgfmath@local@next=\pgfmath@local@@function%
- \fi%
- \fi%
- \pgfmath@local@next%
+ \if#1=%
+ \let\pgfmath@local@next=\pgfmath@local@function@body%
+ \else%
+ \if#1(%
+ \let\pgfmath@local@next=\pgfmath@local@function@args%
+ \else%
+ \expandafter\def\expandafter\pgfmath@local@name\expandafter{\pgfmath@local@name#1}%
+ \let\pgfmath@local@next=\pgfmath@local@@function%
+ \fi%
+ \fi%
+ \pgfmath@local@next%
}
\def\pgfmath@local@function@args#1){%
- \def\pgfmath@local@args{#1}%
- \pgfmath@local@@function}
+ \def\pgfmath@local@args{#1}%
+ \pgfmath@local@@function}
\def\pgfmath@local@function@body#1;{%
- \def\pgfmath@local@body{#1}%
- \begingroup%
- \c@pgf@counta=0\relax%
- \ifx\pgfmath@local@args\pgfmath@empty%
- \expandafter\pgfmath@toks\expandafter=\expandafter{\pgfmath@local@body}%
- \else%
- \pgfmath@toks={}%
- \expandafter\pgfmath@local@function@@body\pgfmath@local@args,,%
- \fi%
- \xdef\pgfmath@local@temp{%
- \noexpand\pgfmathnotifynewdeclarefunction{\pgfmath@local@name}{\the\c@pgf@counta}%
- {\the\pgfmath@toks}%
- }%
- \endgroup%
- \pgfmath@local@temp%
+ \def\pgfmath@local@body{#1}%
+ \begingroup%
+ \c@pgf@counta=0\relax%
+ \ifx\pgfmath@local@args\pgfmath@empty%
+ \expandafter\pgfmath@toks\expandafter=\expandafter{\pgfmath@local@body}%
+ \else%
+ \pgfmath@toks={}%
+ \expandafter\pgfmath@local@function@@body\pgfmath@local@args,,%
+ \fi%
+ \xdef\pgfmath@local@temp{%
+ \noexpand\pgfmathnotifynewdeclarefunction{\pgfmath@local@name}{\the\c@pgf@counta}%
+ {\the\pgfmath@toks}%
+ }%
+ \endgroup%
+ \pgfmath@local@temp%
}
% #1: the name
@@ -178,76 +183,76 @@
% #3: a math expression containing '#1', '#2', ... ,'#'<n>
% This callback is overwritten by pgflibraryluamath.
\def\pgfmathnotifynewdeclarefunction#1#2#3{%
- \pgfmathdeclarefunction{#1}{#2}{\pgfmathparse{#3}}%
+ \pgfmathdeclarefunction{#1}{#2}{\pgfmathparse{#3}}%
}%
\def\pgfmath@local@function@@body#1,{%
- \def\pgfmath@local@test{#1}%
- \ifx\pgfmath@local@test\pgfutil@empty%
- \let\pgfmath@local@next=\relax%
- \else%
- \edef\pgfmath@local@var@string{@\expandafter\pgfmath@local@gobbleone\string#1}%
- \advance\c@pgf@counta by1\relax%
- \expandafter\expandafter\expandafter\pgfmath@toks\expandafter\expandafter\expandafter=%
- \expandafter\expandafter\expandafter{\expandafter\pgfmath@char@hash\the\c@pgf@counta}%
- \edef#1{\the\pgfmath@toks}%
- \pgfmath@toks={}%
- \expandafter\pgfmath@local@function@@@body\pgfmath@local@body @%
- \edef\pgfmath@local@body{\the\pgfmath@toks}%
- \let\pgfmath@local@next=\pgfmath@local@function@@body%
- \fi%
- \pgfmath@local@next%
+ \def\pgfmath@local@test{#1}%
+ \ifx\pgfmath@local@test\pgfutil@empty%
+ \let\pgfmath@local@next=\relax%
+ \else%
+ \edef\pgfmath@local@var@string{@\expandafter\pgfmath@local@gobbleone\string#1}%
+ \advance\c@pgf@counta by1\relax%
+ \expandafter\expandafter\expandafter\pgfmath@toks\expandafter\expandafter\expandafter=%
+ \expandafter\expandafter\expandafter{\expandafter\pgfmath@char@hash\the\c@pgf@counta}%
+ \edef#1{\the\pgfmath@toks}%
+ \pgfmath@toks={}%
+ \expandafter\pgfmath@local@function@@@body\pgfmath@local@body @%
+ \edef\pgfmath@local@body{\the\pgfmath@toks}%
+ \let\pgfmath@local@next=\pgfmath@local@function@@body%
+ \fi%
+ \pgfmath@local@next%
}
-
+
\def\pgfmath@local@function@@@body{%
- \pgfutil@ifnextchar\bgroup{\pgfmath@local@function@@@body@bgroup}%
- {\pgfmath@local@function@@@body@nobgroup}}%
+ \pgfutil@ifnextchar\bgroup{\pgfmath@local@function@@@body@bgroup}%
+ {\pgfmath@local@function@@@body@nobgroup}}%
\def\pgfmath@local@function@@@body@bgroup#1{%
- \begingroup%
- \pgfmath@toks={}%
- \pgfmath@local@function@@@body#1 @%
- \xdef\pgfmath@local@temp{{\the\pgfmath@toks}}%
- \endgroup%
- \expandafter\pgfmath@addto@toks\expandafter{\pgfmath@local@temp}%
- \pgfmath@local@function@@@body%
+ \begingroup%
+ \pgfmath@toks={}%
+ \pgfmath@local@function@@@body#1 @%
+ \xdef\pgfmath@local@temp{{\the\pgfmath@toks}}%
+ \endgroup%
+ \expandafter\pgfmath@addto@toks\expandafter{\pgfmath@local@temp}%
+ \pgfmath@local@function@@@body%
}
\def\pgfmath@local@function@@@body@nobgroup#1{%
- \ifx#1@%
- \let\pgfmath@local@next=\relax%
- \else%
- \let\pgfmath@local@next=\pgfmath@local@function@@@body%
- \edef\pgfmath@local@var@@string{@\expandafter\pgfmath@local@gobbleone\string#1}%
- \ifx\pgfmath@local@var@@string\pgfmath@local@var@string%
- \expandafter\pgfmath@addto@toks\expandafter{#1}%
- \else%
- \edef\pgfmath@local@temp{\the\pgfmath@toks}%
- \pgfmath@toks={#1}%
- \edef\pgfmath@local@@temp{\the\pgfmath@toks}%
- \expandafter\pgfmath@toks\expandafter=\expandafter{\pgfmath@local@temp}%
- \expandafter\pgfmath@addto@toks\expandafter{\pgfmath@local@@temp}%
- \fi%
- \fi%
- \pgfmath@local@next%
+ \ifx#1@%
+ \let\pgfmath@local@next=\relax%
+ \else%
+ \let\pgfmath@local@next=\pgfmath@local@function@@@body%
+ \edef\pgfmath@local@var@@string{@\expandafter\pgfmath@local@gobbleone\string#1}%
+ \ifx\pgfmath@local@var@@string\pgfmath@local@var@string%
+ \expandafter\pgfmath@addto@toks\expandafter{#1}%
+ \else%
+ \edef\pgfmath@local@temp{\the\pgfmath@toks}%
+ \pgfmath@toks={#1}%
+ \edef\pgfmath@local@@temp{\the\pgfmath@toks}%
+ \expandafter\pgfmath@toks\expandafter=\expandafter{\pgfmath@local@temp}%
+ \expandafter\pgfmath@addto@toks\expandafter{\pgfmath@local@@temp}%
+ \fi%
+ \fi%
+ \pgfmath@local@next%
}
% Allows to define 'x' as some \TeX command '#2'.
\def\pgfmathdeclarepseudoconstant#1#2{%
- \pgfmathdeclarefunction*{#1}{0}{#2}%
+ \pgfmathdeclarefunction*{#1}{0}{#2}%
}%
% Redefines a pseudo constant '#1'.
\def\pgfmathredeclarepseudoconstant#1#2{%
- \pgfmathredeclarefunction{#1}{#2}%
+ \pgfmathredeclarefunction{#1}{#2}%
}%
-
+
\input pgfmathfunctions.basic.code.tex
\input pgfmathfunctions.trigonometric.code.tex
\input pgfmathfunctions.random.code.tex
-\input pgfmathfunctions.comparison.code.tex
-\input pgfmathfunctions.base.code.tex
-\input pgfmathfunctions.round.code.tex
-\input pgfmathfunctions.misc.code.tex
+\input pgfmathfunctions.comparison.code.tex
+\input pgfmathfunctions.base.code.tex
+\input pgfmathfunctions.round.code.tex
+\input pgfmathfunctions.misc.code.tex
\input pgfmathfunctions.integerarithmetics.code.tex
diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.comparison.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.comparison.code.tex
index 54a8d64220e..f6e69993e8c 100644
--- a/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.comparison.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.comparison.code.tex
@@ -14,7 +14,7 @@
\pgfmathdeclarefunction{greater}{2}{%
\begingroup%
\ifdim#1pt>#2pt\relax%
- \def\pgfmathresult{1}%
+ \def\pgfmathresult{1}%
\else%
\def\pgfmathresult{0}%
\fi%
@@ -26,7 +26,7 @@
\pgfmathdeclarefunction{less}{2}{%
\begingroup%
\ifdim#1pt<#2pt\relax%
- \def\pgfmathresult{1}%
+ \def\pgfmathresult{1}%
\else%
\def\pgfmathresult{0}%
\fi%
@@ -38,7 +38,7 @@
\pgfmathdeclarefunction{equal}{2}{%
\begingroup%
\ifdim#1pt=#2pt\relax%
- \def\pgfmathresult{1}%
+ \def\pgfmathresult{1}%
\else%
\def\pgfmathresult{0}%
\fi%
@@ -48,26 +48,26 @@
\let\pgfmathequalto=\pgfmathequal
-% approxequalto function from Christian Feuersanger.
+% approxequalto function from Christian Feuersaenger.
%
\newif\ifpgfmathcomparison
\pgfmathdeclarefunction{approxequalto}{2}{%
- \begingroup%
- \pgfmath@x=#1pt\relax%
- \pgfmath@y=#2pt\relax%
- \advance\pgfmath@x by-\pgfmath@y%
- \ifdim\pgfmath@x<0pt\relax%
- \multiply\pgfmath@x by-1\relax%
- \fi
- \ifdim\pgfmath@x<0.0001pt\relax%
- \def\pgfmathresult{1.0}%
- \global\pgfmathcomparisontrue%
- \else%
- \def\pgfmathresult{0.0}%
- \global\pgfmathcomparisonfalse%
- \fi%
- \pgfmath@smuggleone\pgfmathresult%
- \endgroup%
+ \begingroup%
+ \pgfmath@x=#1pt\relax%
+ \pgfmath@y=#2pt\relax%
+ \advance\pgfmath@x by-\pgfmath@y%
+ \ifdim\pgfmath@x<0pt\relax%
+ \multiply\pgfmath@x by-1\relax%
+ \fi
+ \ifdim\pgfmath@x<0.0001pt\relax%
+ \def\pgfmathresult{1.0}%
+ \global\pgfmathcomparisontrue%
+ \else%
+ \def\pgfmathresult{0.0}%
+ \global\pgfmathcomparisonfalse%
+ \fi%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
}
@@ -75,14 +75,14 @@
% ifthenelse function.
%
\pgfmathdeclarefunction{ifthenelse}{3}{%
- \begingroup%
- \ifdim#1pt=0.0pt\relax%
- \expandafter\def\expandafter\pgfmathresult\expandafter{#3}%
- \else%
- \expandafter\def\expandafter\pgfmathresult\expandafter{#2}%
- \fi%
- \pgfmath@smuggleone\pgfmathresult%
- \endgroup%
+ \begingroup%
+ \ifdim#1pt=0.0pt\relax%
+ \expandafter\def\expandafter\pgfmathresult\expandafter{#3}%
+ \else%
+ \expandafter\def\expandafter\pgfmathresult\expandafter{#2}%
+ \fi%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
}
% notequal function.
@@ -90,7 +90,7 @@
\pgfmathdeclarefunction{notequal}{2}{%
\begingroup%
\ifdim#1pt=#2pt\relax%
- \def\pgfmathresult{0}%
+ \def\pgfmathresult{0}%
\else%
\def\pgfmathresult{1}%
\fi%
@@ -103,7 +103,7 @@
\pgfmathdeclarefunction{notless}{2}{%
\begingroup%
\ifdim#1pt<#2pt\relax%
- \def\pgfmathresult{0}%
+ \def\pgfmathresult{0}%
\else%
\def\pgfmathresult{1}%
\fi%
@@ -116,7 +116,7 @@
\pgfmathdeclarefunction{notgreater}{2}{%
\begingroup%
\ifdim#1pt>#2pt\relax%
- \def\pgfmathresult{0}%
+ \def\pgfmathresult{0}%
\else%
\def\pgfmathresult{1}%
\fi%
@@ -128,15 +128,15 @@
%
\pgfmathdeclarefunction{and}{2}{%
\begingroup%
- \def\pgfmathresult{1}%
+ \def\pgfmathresult{1}%
\ifdim#1pt=0pt\relax%
- \def\pgfmathresult{0}%
- \else%
- \ifdim#2pt=0pt\relax%
- \def\pgfmathresult{0}%
- \fi%
- \fi%
- \pgfmath@smuggleone\pgfmathresult%
+ \def\pgfmathresult{0}%
+ \else%
+ \ifdim#2pt=0pt\relax%
+ \def\pgfmathresult{0}%
+ \fi%
+ \fi%
+ \pgfmath@smuggleone\pgfmathresult%
\endgroup%
}
@@ -144,16 +144,16 @@
%
\pgfmathdeclarefunction{or}{2}{%
\begingroup%
- \def\pgfmathresult{0}%
- \ifdim#1pt=0pt\relax%
- \ifdim#2pt=0pt\relax%
- \else%
- \def\pgfmathresult{1}%
- \fi%
- \else%
- \def\pgfmathresult{1}%
- \fi%
- \pgfmath@smuggleone\pgfmathresult%
+ \def\pgfmathresult{0}%
+ \ifdim#1pt=0pt\relax%
+ \ifdim#2pt=0pt\relax%
+ \else%
+ \def\pgfmathresult{1}%
+ \fi%
+ \else%
+ \def\pgfmathresult{1}%
+ \fi%
+ \pgfmath@smuggleone\pgfmathresult%
\endgroup%
}
@@ -161,12 +161,12 @@
%
\pgfmathdeclarefunction{not}{1}{%
\begingroup%
- \ifdim#1pt=0pt\relax%
- \def\pgfmathresult{1}%
- \else%
- \def\pgfmathresult{0}%
- \fi%
- \pgfmath@smuggleone\pgfmathresult%
+ \ifdim#1pt=0pt\relax%
+ \def\pgfmathresult{1}%
+ \else%
+ \def\pgfmathresult{0}%
+ \fi%
+ \pgfmath@smuggleone\pgfmathresult%
\endgroup%
}
diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.integerarithmetics.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.integerarithmetics.code.tex
index 9094da50dc9..ab8f4e6d3c1 100644
--- a/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.integerarithmetics.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.integerarithmetics.code.tex
@@ -11,28 +11,28 @@
\pgfmathcontinuelooptrue
\pgfmath@xa=#1pt
\pgfmath@xb=#2pt
- \ifdim\pgfmath@xa=0pt
+ \ifdim\pgfmath@xa=0pt\relax
\pgfmathcontinueloopfalse
\pgfmath@xa=\pgfmath@xb
- \fi
- \ifdim\pgfmath@xb=0pt
+ \fi
+ \ifdim\pgfmath@xb=0pt\relax
\pgfmathcontinueloopfalse
\pgfmath@xb=\pgfmath@xa
\fi
- \ifdim\pgfmath@xa<0pt
+ \ifdim\pgfmath@xa<0pt\relax
\pgfmath@xa=-\pgfmath@xa
\fi
- \ifdim\pgfmath@xb<0pt
+ \ifdim\pgfmath@xb<0pt\relax
\pgfmath@xb=-\pgfmath@xb
\fi
\loop
- \ifpgfmathcontinueloop
+ \ifpgfmathcontinueloop
\ifdim\pgfmath@xa=\pgfmath@xb
\pgfmathcontinueloopfalse
\else
- \ifdim\pgfmath@xa>\pgfmath@xb
+ \ifdim\pgfmath@xa>\pgfmath@xb
\advance\pgfmath@xa by-\pgfmath@xb
- \else
+ \else
\advance\pgfmath@xb by-\pgfmath@xa
\fi
\fi
@@ -42,14 +42,14 @@
\endgroup}
\newif\ifpgfmath@isprime@unknown
-\newif\ifpgfmath@isprime
+\newif\ifpgfmath@isprime
\pgfmathdeclarefunction{isprime}{1}{%
\begingroup
\pgfmath@isprime@unknowntrue
\pgfmathsetcount\c@pgfmath@counta{abs(int(#1))}%
- \ifcase\c@pgfmath@counta\relax
- % |#1| = 0
+ \ifcase\c@pgfmath@counta\relax
+ % |#1| = 0
\pgfmath@isprimefalse
\pgfmath@isprime@unknownfalse
\or
@@ -66,17 +66,17 @@
\pgfmath@isprime@unknownfalse
\else
% |#1| > 3
- \ifodd\c@pgfmath@counta\relax
+ \ifodd\c@pgfmath@counta\relax
\else
\pgfmath@isprimefalse
\pgfmath@isprime@unknownfalse
\fi
- \fi
+ \fi
\ifpgfmath@isprime@unknown
\c@pgfmath@countd=3
\pgfmath@isprimetrue
\pgfmathloop
- \c@pgfmath@countb=\c@pgfmath@counta
+ \c@pgfmath@countb=\c@pgfmath@counta
\divide\c@pgfmath@countb by\c@pgfmath@countd
\ifnum\c@pgfmath@countb>\c@pgfmath@countd
\pgfmath@isprime@unknowntrue
@@ -84,7 +84,7 @@
\pgfmath@isprime@unknownfalse
\fi
\multiply\c@pgfmath@countb by\c@pgfmath@countd
- \ifnum\c@pgfmath@countb=\c@pgfmath@counta
+ \ifnum\c@pgfmath@countb=\c@pgfmath@counta
\global\pgfmath@isprimefalse
\pgfmath@isprime@unknownfalse
\fi
diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.misc.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.misc.code.tex
index 9b807992787..bab8fefd4eb 100644
--- a/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.misc.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.misc.code.tex
@@ -11,116 +11,116 @@
%
% Version 1.414213 29/9/2007
-% veclen function adpated from ideas due to Rouben Rostamian.
+% veclen function adapted from ideas due to Rouben Rostamian.
%
-% Calcluate the Eulidean length of a 2D vector.
+% Calculate the Euclidean length of a 2D vector.
%
%
-\pgfmathdeclarefunction{veclen}{2}{%
+\pgfmathdeclarefunction{veclen}{2}{%
\begingroup%
\pgfmath@x#1pt\relax%
\pgfmath@y#2pt\relax%
- \ifdim\pgfmath@x<0pt\relax%
- \pgfmath@x-\pgfmath@x%
- \fi%
- \ifdim\pgfmath@y<0pt\relax%
- \pgfmath@y-\pgfmath@y%
- \fi%
- \ifdim\pgfmath@x=0pt\relax%
- \pgfmath@x\pgfmath@y%
- \else%
- \ifdim\pgfmath@y=0pt\relax%
- \else%
- \ifdim\pgfmath@x>\pgfmath@y%
- \pgfmath@xa\pgfmath@x%
- \pgfmath@x\pgfmath@y%
- \pgfmath@y\pgfmath@xa%
- \fi%
- % We use a scaling factor to reduce errors.
- \ifdim\pgfmath@y>10000pt\relax%
- \c@pgfmath@counta1500\relax%
- \else%
- \ifdim\pgfmath@y>1000pt\relax%
- \c@pgfmath@counta150\relax%
- \else%
- \ifdim\pgfmath@y>100pt\relax%
- \c@pgfmath@counta50\relax%
- \else%
- \c@pgfmath@counta1\relax%
- \fi%
- \fi%
- \fi%
- \divide\pgfmath@x\c@pgfmath@counta\relax%
- \divide\pgfmath@y\c@pgfmath@counta\relax%
- \pgfmathreciprocal@{\pgfmath@tonumber{\pgfmath@y}}%
- \pgfmath@x\pgfmathresult\pgfmath@x%
- \pgfmath@xa\pgfmath@tonumber{\pgfmath@x}\pgfmath@x%
- \edef\pgfmath@temp{\pgfmath@tonumber{\pgfmath@xa}}%
- %
- % Use A+x^2*(B+x^2*(C+x^2*(D+E*x^2)))
- % where
- % A = +1.000012594
- % B = +0.4993615349
- % C = -0.1195159052
- % D = +0.04453994279
- % E = -0.01019210944
- %
- \pgfmath@x-0.01019210944\pgfmath@xa%
- \advance\pgfmath@x0.04453994279pt\relax%
- \pgfmath@x\pgfmath@temp\pgfmath@x%
- \advance\pgfmath@x-0.1195159052pt\relax%
- \pgfmath@x\pgfmath@temp\pgfmath@x%
- \advance\pgfmath@x0.4993615349pt\relax%
- \pgfmath@x\pgfmath@temp\pgfmath@x%
- \advance\pgfmath@x1.000012594pt\relax%
- \ifdim\pgfmath@y<0pt\relax%
- \pgfmath@y-\pgfmath@y%
- \fi%
- \pgfmath@x\pgfmath@tonumber{\pgfmath@y}\pgfmath@x%
- % Invert the scaling factor.
- \multiply\pgfmath@x\c@pgfmath@counta\relax%
- \fi%
- \fi%
- \pgfmath@returnone\pgfmath@x%
- \endgroup%
+ \ifdim\pgfmath@x<0pt\relax%
+ \pgfmath@x-\pgfmath@x%
+ \fi%
+ \ifdim\pgfmath@y<0pt\relax%
+ \pgfmath@y-\pgfmath@y%
+ \fi%
+ \ifdim\pgfmath@x=0pt\relax%
+ \pgfmath@x\pgfmath@y%
+ \else%
+ \ifdim\pgfmath@y=0pt\relax%
+ \else%
+ \ifdim\pgfmath@x>\pgfmath@y%
+ \pgfmath@xa\pgfmath@x%
+ \pgfmath@x\pgfmath@y%
+ \pgfmath@y\pgfmath@xa%
+ \fi%
+ % We use a scaling factor to reduce errors.
+ \ifdim\pgfmath@y>10000pt\relax%
+ \c@pgfmath@counta1500\relax%
+ \else%
+ \ifdim\pgfmath@y>1000pt\relax%
+ \c@pgfmath@counta150\relax%
+ \else%
+ \ifdim\pgfmath@y>100pt\relax%
+ \c@pgfmath@counta50\relax%
+ \else%
+ \c@pgfmath@counta1\relax%
+ \fi%
+ \fi%
+ \fi%
+ \divide\pgfmath@x\c@pgfmath@counta\relax%
+ \divide\pgfmath@y\c@pgfmath@counta\relax%
+ \pgfmathreciprocal@{\pgfmath@tonumber{\pgfmath@y}}%
+ \pgfmath@x\pgfmathresult\pgfmath@x%
+ \pgfmath@xa\pgfmath@tonumber{\pgfmath@x}\pgfmath@x%
+ \edef\pgfmath@temp{\pgfmath@tonumber{\pgfmath@xa}}%
+ %
+ % Use A+x^2*(B+x^2*(C+x^2*(D+E*x^2)))
+ % where
+ % A = +1.000012594
+ % B = +0.4993615349
+ % C = -0.1195159052
+ % D = +0.04453994279
+ % E = -0.01019210944
+ %
+ \pgfmath@x-0.01019210944\pgfmath@xa%
+ \advance\pgfmath@x0.04453994279pt\relax%
+ \pgfmath@x\pgfmath@temp\pgfmath@x%
+ \advance\pgfmath@x-0.1195159052pt\relax%
+ \pgfmath@x\pgfmath@temp\pgfmath@x%
+ \advance\pgfmath@x0.4993615349pt\relax%
+ \pgfmath@x\pgfmath@temp\pgfmath@x%
+ \advance\pgfmath@x1.000012594pt\relax%
+ \ifdim\pgfmath@y<0pt\relax%
+ \pgfmath@y-\pgfmath@y%
+ \fi%
+ \pgfmath@x\pgfmath@tonumber{\pgfmath@y}\pgfmath@x%
+ % Invert the scaling factor.
+ \multiply\pgfmath@x\c@pgfmath@counta\relax%
+ \fi%
+ \fi%
+ \pgfmath@returnone\pgfmath@x%
+ \endgroup%
}
% Hyperbolic functions contributed by Martin Heller.
%
\pgfmathdeclarefunction{cosh}{1}{%
- \begingroup
- \edef\pgfmath@arg{#1}%
- \pgfmathexp@{\pgfmath@arg}%
- \pgfmath@x=\pgfmathresult pt\relax%
- \pgfmathexp@{-\pgfmath@arg}%
- \advance\pgfmath@x by\pgfmathresult pt\relax%
- \divide\pgfmath@x by2\relax%
- \pgfmath@returnone\pgfmath@x%
- \endgroup}
+ \begingroup
+ \edef\pgfmath@arg{#1}%
+ \pgfmathexp@{\pgfmath@arg}%
+ \pgfmath@x=\pgfmathresult pt\relax%
+ \pgfmathexp@{-\pgfmath@arg}%
+ \advance\pgfmath@x by\pgfmathresult pt\relax%
+ \divide\pgfmath@x by2\relax%
+ \pgfmath@returnone\pgfmath@x%
+ \endgroup}
\pgfmathdeclarefunction{sinh}{1}{%
- \begingroup
- \edef\pgfmath@arg{#1}%
- \pgfmathexp@{\pgfmath@arg}%
- \pgfmath@x=\pgfmathresult pt\relax%
- \pgfmathexp@{-\pgfmath@arg}%
- \advance\pgfmath@x by-\pgfmathresult pt\relax%
- \divide\pgfmath@x by2\relax%
- \pgfmath@returnone\pgfmath@x%
- \endgroup
+ \begingroup
+ \edef\pgfmath@arg{#1}%
+ \pgfmathexp@{\pgfmath@arg}%
+ \pgfmath@x=\pgfmathresult pt\relax%
+ \pgfmathexp@{-\pgfmath@arg}%
+ \advance\pgfmath@x by-\pgfmathresult pt\relax%
+ \divide\pgfmath@x by2\relax%
+ \pgfmath@returnone\pgfmath@x%
+ \endgroup
}%
\pgfmathdeclarefunction{tanh}{1}{%
- \begingroup
- \edef\pgfmath@arg{#1}%
- \pgfmathsinh@{\pgfmath@arg}%
- \pgfmath@x=\pgfmathresult pt\relax%
- \pgfmathcosh@{\pgfmath@arg}%
- \pgfmath@y=\pgfmathresult pt\relax%
- \pgfmathdivide@{\pgfmath@tonumber{\pgfmath@x}}{\pgfmath@tonumber{\pgfmath@y}}%
- \pgfmath@x=\pgfmathresult pt\relax%
- \pgfmath@returnone\pgfmath@x%
- \endgroup
+ \begingroup
+ \edef\pgfmath@arg{#1}%
+ \pgfmathsinh@{\pgfmath@arg}%
+ \pgfmath@x=\pgfmathresult pt\relax%
+ \pgfmathcosh@{\pgfmath@arg}%
+ \pgfmath@y=\pgfmathresult pt\relax%
+ \pgfmathdivide@{\pgfmath@tonumber{\pgfmath@x}}{\pgfmath@tonumber{\pgfmath@y}}%
+ \pgfmath@x=\pgfmathresult pt\relax%
+ \pgfmath@returnone\pgfmath@x%
+ \endgroup
}%
% \pgfmathscientific
@@ -134,136 +134,136 @@
% NB These arguments *are not parsed*, as the long mantissa would be lost.
%
\def\pgfmathscientific#1#2{%
- \begingroup%
- \edef\pgfmath@sci@exponent{#2}%
- \pgfmath@x#1pt\relax%
- \ifdim\pgfmath@x<0pt\relax%
- \pgfmath@x-\pgfmath@x%
- \edef\pgfmath@sci@sign{-}%
- \expandafter\edef\expandafter\pgfmath@temp\expandafter{\expandafter\pgfmath@gobbleone#1}%
- \else%
- \edef\pgfmath@sci@sign{+}%
- \edef\pgfmath@temp{#1}%
- \fi%
- \expandafter\pgfmath@in@\expandafter.\expandafter{#1}%
- \ifpgfmath@in@%
- \else%
- \edef\pgfmath@temp{\pgfmath@temp.0}%
- \fi%
- \expandafter\pgfmath@scientific@@\pgfmath@temp00000000000\pgfmath@}
+ \begingroup%
+ \edef\pgfmath@sci@exponent{#2}%
+ \pgfmath@x#1pt\relax%
+ \ifdim\pgfmath@x<0pt\relax%
+ \pgfmath@x-\pgfmath@x%
+ \edef\pgfmath@sci@sign{-}%
+ \expandafter\edef\expandafter\pgfmath@temp\expandafter{\expandafter\pgfmath@gobbleone#1}%
+ \else%
+ \edef\pgfmath@sci@sign{+}%
+ \edef\pgfmath@temp{#1}%
+ \fi%
+ \expandafter\pgfmath@in@\expandafter.\expandafter{#1}%
+ \ifpgfmath@in@%
+ \else%
+ \edef\pgfmath@temp{\pgfmath@temp.0}%
+ \fi%
+ \expandafter\pgfmath@scientific@@\pgfmath@temp00000000000\pgfmath@}
\def\pgfmath@scientific@@#1.#2#3#4#5#6{%
- \edef\pgfmath@sci@int{#1}%
- \edef\pgfmath@sci@mantissaA{#2#3#4#5#6}%
- \pgfmath@scientific@@@}
-
+ \edef\pgfmath@sci@int{#1}%
+ \edef\pgfmath@sci@mantissaA{#2#3#4#5#6}%
+ \pgfmath@scientific@@@}
+
\def\pgfmath@scientific@@@#1#2#3#4#5#6\pgfmath@{%
- \edef\pgfmath@sci@mantissaB{#1#2#3#4#5}%
- \c@pgfmath@counta\pgfmath@sci@exponent\relax%
+ \edef\pgfmath@sci@mantissaB{#1#2#3#4#5}%
+ \c@pgfmath@counta\pgfmath@sci@exponent\relax%
\ifnum\c@pgfmath@counta<-4\relax%
\pgfmath@x0pt\relax%
\else%
- \c@pgfmath@countb\c@pgfmath@counta%
- \ifnum\c@pgfmath@counta<0\relax%
- \c@pgfmath@counta-\c@pgfmath@counta%
- \fi%
- \pgfmathpow@{10}{\the\c@pgfmath@counta}%
- \afterassignment\pgfmath@gobbletilpgfmath@
- \c@pgfmath@countc\pgfmathresult\relax\pgfmath@
- \edef\pgfmath@sci@factor{\the\c@pgfmath@countc}%
- \ifnum\c@pgfmath@countb<0\relax%
- % xE-y: easy...
- \pgfmath@x\pgfmath@sci@int.\pgfmath@sci@mantissaA pt\relax%
- \divide\pgfmath@x\pgfmath@sci@factor\relax%
- \else%
- % xE+y:
- % Must do this way so as not lose digits in a long mantissa. Sigh...
- \c@pgfmath@counta\pgfmath@sci@int%
- \c@pgfmath@countb\pgfmath@sci@mantissaA%
- \multiply\c@pgfmath@counta\pgfmath@sci@factor\relax%
- \multiply\c@pgfmath@countb\pgfmath@sci@factor\relax%
- \c@pgfmath@countc\c@pgfmath@countb%
- \divide\c@pgfmath@countb100000\relax%
- \advance\c@pgfmath@counta\c@pgfmath@countb%
- \multiply\c@pgfmath@countb100000\relax%
- \advance\c@pgfmath@countc-\c@pgfmath@countb%
- \c@pgfmath@countb\pgfmath@sci@mantissaB\relax%
- \multiply\c@pgfmath@countb\pgfmath@sci@factor\relax%
- \divide\c@pgfmath@countb100000\relax%
- \advance\c@pgfmath@countc\c@pgfmath@countb%
- \advance\c@pgfmath@countc100000\relax%
- \edef\pgfmath@sci@result{\pgfmath@sci@sign\the\c@pgfmath@counta.\expandafter\pgfmath@gobbleone\the\c@pgfmath@countc pt}%
- \pgfmath@x\pgfmath@sci@result\relax%
- \fi\fi%
- \pgfmath@returnone\pgfmath@x%
- \endgroup}
-
+ \c@pgfmath@countb\c@pgfmath@counta%
+ \ifnum\c@pgfmath@counta<0\relax%
+ \c@pgfmath@counta-\c@pgfmath@counta%
+ \fi%
+ \pgfmathpow@{10}{\the\c@pgfmath@counta}%
+ \afterassignment\pgfmath@gobbletilpgfmath@
+ \c@pgfmath@countc\pgfmathresult\relax\pgfmath@
+ \edef\pgfmath@sci@factor{\the\c@pgfmath@countc}%
+ \ifnum\c@pgfmath@countb<0\relax%
+ % xE-y: easy...
+ \pgfmath@x\pgfmath@sci@int.\pgfmath@sci@mantissaA pt\relax%
+ \divide\pgfmath@x\pgfmath@sci@factor\relax%
+ \else%
+ % xE+y:
+ % Must do this way so as not lose digits in a long mantissa. Sigh...
+ \c@pgfmath@counta\pgfmath@sci@int%
+ \c@pgfmath@countb\pgfmath@sci@mantissaA%
+ \multiply\c@pgfmath@counta\pgfmath@sci@factor\relax%
+ \multiply\c@pgfmath@countb\pgfmath@sci@factor\relax%
+ \c@pgfmath@countc\c@pgfmath@countb%
+ \divide\c@pgfmath@countb100000\relax%
+ \advance\c@pgfmath@counta\c@pgfmath@countb%
+ \multiply\c@pgfmath@countb100000\relax%
+ \advance\c@pgfmath@countc-\c@pgfmath@countb%
+ \c@pgfmath@countb\pgfmath@sci@mantissaB\relax%
+ \multiply\c@pgfmath@countb\pgfmath@sci@factor\relax%
+ \divide\c@pgfmath@countb100000\relax%
+ \advance\c@pgfmath@countc\c@pgfmath@countb%
+ \advance\c@pgfmath@countc100000\relax%
+ \edef\pgfmath@sci@result{\pgfmath@sci@sign\the\c@pgfmath@counta.\expandafter\pgfmath@gobbleone\the\c@pgfmath@countc pt}%
+ \pgfmath@x\pgfmath@sci@result\relax%
+ \fi\fi%
+ \pgfmath@returnone\pgfmath@x%
+ \endgroup}
+
% width function.
%
\pgfmathdeclarefunction{width}{1}{%
- \begingroup%
- \setbox\pgfmath@box=\hbox{{\pgfmath@selectfont{#1}}}%
- \pgfmath@x=\wd\pgfmath@box%
- \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@x}}%
- \pgfmath@smuggleone\pgfmathresult%
- \endgroup%
+ \begingroup%
+ \setbox\pgfmath@box=\hbox{{\pgfmath@selectfont{#1}}}%
+ \pgfmath@x=\wd\pgfmath@box%
+ \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@x}}%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
}
% height function.
%
\pgfmathdeclarefunction{height}{1}{%
- \begingroup%
- \setbox\pgfmath@box=\hbox{{\pgfmath@selectfont{#1}}}%
- \pgfmath@x=\ht\pgfmath@box%
- \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@x}}%
- \pgfmath@smuggleone\pgfmathresult%
- \endgroup%
+ \begingroup%
+ \setbox\pgfmath@box=\hbox{{\pgfmath@selectfont{#1}}}%
+ \pgfmath@x=\ht\pgfmath@box%
+ \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@x}}%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
}
% depth function.
%
\pgfmathdeclarefunction{depth}{1}{%
- \begingroup%
- \setbox\pgfmath@box=\hbox{{\pgfmath@selectfont{#1}}}%
- \pgfmath@x=\dp\pgfmath@box%
- \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@x}}%
- \pgfmath@smuggleone\pgfmathresult%
- \endgroup%
+ \begingroup%
+ \setbox\pgfmath@box=\hbox{{\pgfmath@selectfont{#1}}}%
+ \pgfmath@x=\dp\pgfmath@box%
+ \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@x}}%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
}
% array function.
%
\pgfmathdeclarefunction{array}{2}{%
- \begingroup%
- \afterassignment\pgfmath@gobbletilpgfmath@\pgfmath@count=#2\relax\pgfmath@%
- \expandafter\pgfmatharray@@#1\pgfmath@stop%
+ \begingroup%
+ \afterassignment\pgfmath@gobbletilpgfmath@\pgfmath@count=#2\relax\pgfmath@%
+ \expandafter\pgfmatharray@@#1\pgfmath@stop%
}
\def\pgfmath@token@stop{\pgfmath@stop}%
\def\pgfmatharray@@#1{%
- \def\pgfmath@temp{#1}%
- \advance\pgfmath@count by-1\relax%
- \ifx\pgfmath@temp\pgfmath@token@stop%
- \pgfmath@error{Array index out of bounds.}{}%
- \def\pgfmathresult{0}%
- \pgfmath@smuggleone\pgfmathresult\endgroup%
- \let\pgfmath@next=\relax%
- \else%
- \ifnum\pgfmath@count=-1\relax%
- \def\pgfmathresult{#1}%
- \let\pgfmath@next=\pgfmatharray@@@%
- \else%
- \let\pgfmath@next=\pgfmatharray@@%
- \fi%
- \fi%
- \pgfmath@next}
+ \def\pgfmath@temp{#1}%
+ \advance\pgfmath@count by-1\relax%
+ \ifx\pgfmath@temp\pgfmath@token@stop%
+ \pgfmath@error{Array index out of bounds.}{}%
+ \def\pgfmathresult{0}%
+ \pgfmath@smuggleone\pgfmathresult\endgroup%
+ \let\pgfmath@next=\relax%
+ \else%
+ \ifnum\pgfmath@count=-1\relax%
+ \def\pgfmathresult{#1}%
+ \let\pgfmath@next=\pgfmatharray@@@%
+ \else%
+ \let\pgfmath@next=\pgfmatharray@@%
+ \fi%
+ \fi%
+ \pgfmath@next}
\def\pgfmatharray@@@#1\pgfmath@stop{%
- \pgfmath@smuggleone\pgfmathresult\endgroup%
+ \pgfmath@smuggleone\pgfmathresult\endgroup%
}
% dim function: return dimension of an array
@@ -288,55 +288,55 @@
% max function.
%
\pgfmathdeclarefunction{max}{...}{%
- \begingroup%
- \pgfmath@x=-16383pt\relax%
- \pgfmathmax@@#1{}}
+ \begingroup%
+ \pgfmath@x=-16383pt\relax%
+ \pgfmathmax@@#1{}}
\def\pgfmathmax@@#1{%
- \def\pgfmath@temp{#1}%
- \ifx\pgfmath@temp\pgfmath@empty%
- \let\pgfmath@next=\pgfmathmax@@@%
- \else%
- \ifdim#1pt>\pgfmath@x%
- \pgfmath@x=#1pt\relax%
- \fi%
- \let\pgfmath@next=\pgfmathmax@@%
- \fi%
- \pgfmath@next}
+ \def\pgfmath@temp{#1}%
+ \ifx\pgfmath@temp\pgfmath@empty%
+ \let\pgfmath@next=\pgfmathmax@@@%
+ \else%
+ \ifdim#1pt>\pgfmath@x%
+ \pgfmath@x=#1pt\relax%
+ \fi%
+ \let\pgfmath@next=\pgfmathmax@@%
+ \fi%
+ \pgfmath@next}
\def\pgfmathmax@@@{\pgfmath@returnone\pgfmath@x\endgroup}%
-% For compatability with old code.
+% For computability with old code.
\def\pgfmathmax#1#2{%
- \pgfmathparse{#1,#2}%
- \expandafter\pgfmathmax@\expandafter{\pgfmathresult}%
+ \pgfmathparse{#1,#2}%
+ \expandafter\pgfmathmax@\expandafter{\pgfmathresult}%
}
% min function.
%
\pgfmathdeclarefunction{min}{...}{%
- \begingroup%
- \pgfmath@x=16383pt\relax%
- \pgfmathmin@@#1{}}
+ \begingroup%
+ \pgfmath@x=16383pt\relax%
+ \pgfmathmin@@#1{}}
\def\pgfmathmin@@#1{%
- \def\pgfmath@temp{#1}%
- \ifx\pgfmath@temp\pgfmath@empty%
- \let\pgfmath@next=\pgfmathmin@@@%
- \else%
- \ifdim#1pt<\pgfmath@x%
- \pgfmath@x=#1pt\relax%
- \fi%
- \let\pgfmath@next=\pgfmathmin@@%
- \fi%
- \pgfmath@next}
+ \def\pgfmath@temp{#1}%
+ \ifx\pgfmath@temp\pgfmath@empty%
+ \let\pgfmath@next=\pgfmathmin@@@%
+ \else%
+ \ifdim#1pt<\pgfmath@x%
+ \pgfmath@x=#1pt\relax%
+ \fi%
+ \let\pgfmath@next=\pgfmathmin@@%
+ \fi%
+ \pgfmath@next}
\def\pgfmathmin@@@{\pgfmath@returnone\pgfmath@x\endgroup}%
-% For compatability with old code.
+% For computability with old code.
\def\pgfmathmin#1#2{%
- \pgfmathparse{#1,#2}%
- \expandafter\pgfmathmin@\expandafter{\pgfmathresult}%
+ \pgfmathparse{#1,#2}%
+ \expandafter\pgfmathmin@\expandafter{\pgfmathresult}%
}
@@ -346,4 +346,4 @@
\pgfmathdeclarefunction{scalar}{1}{%
\def\pgfmathresult{#1}%
\global\pgfmathunitsdeclaredfalse%
-} \ No newline at end of file
+}
diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.random.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.random.code.tex
index 44b8ef8f6ef..531383dfdcd 100644
--- a/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.random.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.random.code.tex
@@ -7,7 +7,7 @@
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
-% This file defines the pesudorandom numbers.
+% This file defines the pseudorandom numbers.
%
% Version 1.414213 29/9/2007
@@ -15,8 +15,8 @@
%
% See:
% \book@{pressetal1992,
-% author = {William H. Press and Brian P. Flannery and Saul A.
-% Teukolsky and William T. Vetterling},
+% author = {William H. Press and Brian P. Flannery and Saul A.
+% Teukolsky and William T. Vetterling},
% title = {Numerical Recipies in C},
% edition = {Second},
% publisher = {Cambridge University Press}
@@ -30,23 +30,26 @@
\begingroup
\c@pgfmath@counta=\time%
\multiply\c@pgfmath@counta by\year%
-\xdef\pgfmath@rnd@z{\the\c@pgfmath@counta}% The seed.
+\ifnum\c@pgfmath@counta=0
+ \c@pgfmath@counta=1
+\fi
+\xdef\pgfmath@rnd@z{\the\c@pgfmath@counta}% The seed.
\endgroup
% \pgfmathsetseed
%
-% Explictly set the seed for the generator
-%
+% Explicitly set the seed for the generator
+%
% #1 -> the new seed.
%
\def\pgfmathsetseed#1{%
- % Attention pgflibraryluamath.code.tex relies on the fact that
- % this method also modifies \pgfmathresult:
- \pgfmathparse{#1}\expandafter\pgfmath@setseed\pgfmathresult.0\pgfmath@stop
+ % Attention pgflibraryluamath.code.tex relies on the fact that
+ % this method also modifies \pgfmathresult:
+ \pgfmathparse{#1}\expandafter\pgfmath@setseed\pgfmathresult.0\pgfmath@stop
}%
-\def\pgfmath@setseed#1.#2\pgfmath@stop{\def\pgfmath@rnd@z{#1}}%
+\def\pgfmath@setseed#1.#2\pgfmath@stop{\def\pgfmath@rnd@z{#1}}%
-% Alternative paramaters - see Press et al (1992) p278-279,
+% Alternative parameters - see Press et al (1992) p278-279,
% for discussion.
%
% a=16807 q=127773 r=2836
@@ -57,33 +60,33 @@
\def\pgfmath@rnd@q{30845}
% \pgfmathgeneratepseudorandomnumber
-%
+%
% A linear congruency generator for generating
% pseudo-random numbers. Generates numbers in
% the range 1 - 2^31-1.
%
\def\pgfmathgeneratepseudorandomnumber{%
- \begingroup%
- \c@pgfmath@counta=\pgfmath@rnd@z%
- \c@pgfmath@countb=\pgfmath@rnd@z%
- \c@pgfmath@countc=\pgfmath@rnd@q%
- \divide\c@pgfmath@counta by\c@pgfmath@countc%
- \multiply\c@pgfmath@counta by-\c@pgfmath@countc%
- \advance\c@pgfmath@counta by\c@pgfmath@countb
- \c@pgfmath@countc=\pgfmath@rnd@a%
- \multiply\c@pgfmath@counta by\c@pgfmath@countc%
- \c@pgfmath@countc=\pgfmath@rnd@q%
- \divide\c@pgfmath@countb by\c@pgfmath@countc%
- \c@pgfmath@countc=\pgfmath@rnd@r%
- \multiply\c@pgfmath@countb by\c@pgfmath@countc%
- \advance\c@pgfmath@counta by-\c@pgfmath@countb%
- \ifnum\c@pgfmath@counta<0\relax%
- \c@pgfmath@countb=\pgfmath@rnd@m%
- \advance\c@pgfmath@counta by\c@pgfmath@countb%
- \fi%
- \xdef\pgfmath@rnd@z{\the\c@pgfmath@counta}%
- \endgroup%
- \edef\pgfmathresult{\pgfmath@rnd@z}%
+ \begingroup%
+ \c@pgfmath@counta=\pgfmath@rnd@z%
+ \c@pgfmath@countb=\pgfmath@rnd@z%
+ \c@pgfmath@countc=\pgfmath@rnd@q%
+ \divide\c@pgfmath@counta by\c@pgfmath@countc%
+ \multiply\c@pgfmath@counta by-\c@pgfmath@countc%
+ \advance\c@pgfmath@counta by\c@pgfmath@countb
+ \c@pgfmath@countc=\pgfmath@rnd@a%
+ \multiply\c@pgfmath@counta by\c@pgfmath@countc%
+ \c@pgfmath@countc=\pgfmath@rnd@q%
+ \divide\c@pgfmath@countb by\c@pgfmath@countc%
+ \c@pgfmath@countc=\pgfmath@rnd@r%
+ \multiply\c@pgfmath@countb by\c@pgfmath@countc%
+ \advance\c@pgfmath@counta by-\c@pgfmath@countb%
+ \ifnum\c@pgfmath@counta<0\relax%
+ \c@pgfmath@countb=\pgfmath@rnd@m%
+ \advance\c@pgfmath@counta by\c@pgfmath@countb%
+ \fi%
+ \xdef\pgfmath@rnd@z{\the\c@pgfmath@counta}%
+ \endgroup%
+ \edef\pgfmathresult{\pgfmath@rnd@z}%
}
% \pgfmathrnd
@@ -91,22 +94,22 @@
% Generates a pseudo-random number between 0 and 1.
%
\pgfmathdeclarefunction{rnd}{0}{%
- \begingroup%
- \pgfmathgeneratepseudorandomnumber%
- \c@pgfmath@counta\pgfmathresult%
- \c@pgfmath@countb\c@pgfmath@counta%
- \divide\c@pgfmath@countb100001\relax% To get one.
- \multiply\c@pgfmath@countb-100001\relax%
- \advance\c@pgfmath@countb\c@pgfmath@counta%
- \advance\c@pgfmath@countb1000000\relax%
- \expandafter\pgfmathrnd@@\the\c@pgfmath@countb\pgfmath@%
- \pgfmath@returnone\pgfmath@x%
- \endgroup%
+ \begingroup%
+ \pgfmathgeneratepseudorandomnumber%
+ \c@pgfmath@counta\pgfmathresult%
+ \c@pgfmath@countb\c@pgfmath@counta%
+ \divide\c@pgfmath@countb100001\relax% To get one.
+ \multiply\c@pgfmath@countb-100001\relax%
+ \advance\c@pgfmath@countb\c@pgfmath@counta%
+ \advance\c@pgfmath@countb1000000\relax%
+ \expandafter\pgfmathrnd@@\the\c@pgfmath@countb\pgfmath@%
+ \pgfmath@returnone\pgfmath@x%
+ \endgroup%
}%
\def\pgfmathrnd@@#1#2#3\pgfmath@{%
- \edef\pgfmath@temp{#2.#3}%
- \pgfmath@x=\pgfmath@temp pt\relax%
+ \edef\pgfmath@temp{#2.#3}%
+ \pgfmath@x=\pgfmath@temp pt\relax%
}%
% \pgfmathrand
@@ -114,57 +117,57 @@
% Generates a pseudo-random number between -1 and 1.
%
\pgfmathdeclarefunction{rand}{0}{%
- \begingroup%
- \pgfmathgeneratepseudorandomnumber%
- \c@pgfmath@counta\pgfmathresult%
- \c@pgfmath@countb\c@pgfmath@counta%
- \divide\c@pgfmath@countb200001\relax%
- \multiply\c@pgfmath@countb-200001\relax%
- \advance\c@pgfmath@countb\c@pgfmath@counta%
- \advance\c@pgfmath@countb-100000\relax%
- \ifnum\c@pgfmath@countb<0\relax%
- \advance\c@pgfmath@countb-1000000\relax%
- \else%
- \advance\c@pgfmath@countb1000000\relax%
- \fi%
- \expandafter\pgfmathrand@@\the\c@pgfmath@countb\pgfmath@%
- \pgfmath@returnone\pgfmath@x%
- \endgroup%
+ \begingroup%
+ \pgfmathgeneratepseudorandomnumber%
+ \c@pgfmath@counta\pgfmathresult%
+ \c@pgfmath@countb\c@pgfmath@counta%
+ \divide\c@pgfmath@countb200001\relax%
+ \multiply\c@pgfmath@countb-200001\relax%
+ \advance\c@pgfmath@countb\c@pgfmath@counta%
+ \advance\c@pgfmath@countb-100000\relax%
+ \ifnum\c@pgfmath@countb<0\relax%
+ \advance\c@pgfmath@countb-1000000\relax%
+ \else%
+ \advance\c@pgfmath@countb1000000\relax%
+ \fi%
+ \expandafter\pgfmathrand@@\the\c@pgfmath@countb\pgfmath@%
+ \pgfmath@returnone\pgfmath@x%
+ \endgroup%
}%
\def\pgfmathrand@@#1#2#3#4\pgfmath@{%
- \ifx#1-%
- \edef\pgfmath@temp{-#3.#4}%
- \else%
- \edef\pgfmath@temp{#2.#3#4}%
- \fi%
- \pgfmath@x=\pgfmath@temp pt\relax%
+ \ifx#1-%
+ \edef\pgfmath@temp{-#3.#4}%
+ \else%
+ \edef\pgfmath@temp{#2.#3#4}%
+ \fi%
+ \pgfmath@x=\pgfmath@temp pt\relax%
}%
\pgfmathdeclarefunction{random}{...}{%
- \begingroup%
- \def\pgfmath@temp{#1}%
- \ifx\pgfmath@temp\pgfmath@empty%
- \pgfmathrnd@%
- \else%
- \expandafter\pgfmathrandom@@#1\pgfmath@stop%
- \fi%
- \pgfmath@smuggleone\pgfmathresult%
- \endgroup}
+ \begingroup%
+ \def\pgfmath@temp{#1}%
+ \ifx\pgfmath@temp\pgfmath@empty%
+ \pgfmathrnd@%
+ \else%
+ \expandafter\pgfmathrandom@@#1\pgfmath@stop%
+ \fi%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup}
\def\pgfmathrandom@@{\futurelet\pgfmath@token\pgfmathrandom@@@}
\def\pgfmathrandom@@@{%
- \ifx\pgfmath@token\bgroup%
- \expandafter\pgfmath@random@@@@%
- \else%
- \expandafter\pgfmath@random@@@@@%
- \fi%
+ \ifx\pgfmath@token\bgroup%
+ \expandafter\pgfmath@random@@@@%
+ \else%
+ \expandafter\pgfmath@random@@@@@%
+ \fi%
}
\def\pgfmath@random@@@@@#1\pgfmath@stop{%
- \pgfmathrandominteger\pgfmathresult{1}{#1}%
+ \pgfmathrandominteger\pgfmathresult{1}{#1}%
}
\def\pgfmath@random@@@@#1#2\pgfmath@stop{%
- \pgfmathrandominteger\pgfmathresult{#1}{#2}%
+ \pgfmathrandominteger\pgfmathresult{#1}{#2}%
}
% \pgfmathrandominteger
@@ -176,29 +179,29 @@
% #3 - the upper limit of the range.
%
\def\pgfmathrandominteger#1#2#3{%
- \begingroup%
- \pgfmathgeneratepseudorandomnumber%
- \c@pgfmath@counta#2\relax%
- \c@pgfmath@countb#3\relax%
- \c@pgfmath@countc\c@pgfmath@countb%
- % OK. Maybe #2 > #3.
- \ifnum\c@pgfmath@counta>\c@pgfmath@countb\relax%
- \c@pgfmath@countc\c@pgfmath@countb%
- \c@pgfmath@countb\c@pgfmath@counta%
- \c@pgfmath@counta\c@pgfmath@countc%
- \fi%
- \advance\c@pgfmath@countc1\relax%
- \advance\c@pgfmath@countc-\c@pgfmath@counta%
- \c@pgfmath@counta\pgfmathresult\relax%
- \c@pgfmath@countb\c@pgfmath@counta%
- \divide\c@pgfmath@countb\c@pgfmath@countc%
- \multiply\c@pgfmath@countb-\c@pgfmath@countc%
- \advance\c@pgfmath@counta\c@pgfmath@countb%
- \advance\c@pgfmath@counta#2\relax%
- \edef\pgfmathresult{\the\c@pgfmath@counta}%
- \pgfmath@smuggleone{\pgfmathresult}%
- \endgroup%
- \edef#1{\pgfmathresult}%
+ \begingroup%
+ \pgfmathgeneratepseudorandomnumber%
+ \c@pgfmath@counta#2\relax%
+ \c@pgfmath@countb#3\relax%
+ \c@pgfmath@countc\c@pgfmath@countb%
+ % OK. Maybe #2 > #3.
+ \ifnum\c@pgfmath@counta>\c@pgfmath@countb\relax%
+ \c@pgfmath@countc\c@pgfmath@countb%
+ \c@pgfmath@countb\c@pgfmath@counta%
+ \c@pgfmath@counta\c@pgfmath@countc%
+ \fi%
+ \advance\c@pgfmath@countc1\relax%
+ \advance\c@pgfmath@countc-\c@pgfmath@counta%
+ \c@pgfmath@counta\pgfmathresult\relax%
+ \c@pgfmath@countb\c@pgfmath@counta%
+ \divide\c@pgfmath@countb\c@pgfmath@countc%
+ \multiply\c@pgfmath@countb-\c@pgfmath@countc%
+ \advance\c@pgfmath@counta\c@pgfmath@countb%
+ \advance\c@pgfmath@counta#2\relax%
+ \edef\pgfmathresult{\the\c@pgfmath@counta}%
+ \pgfmath@smuggleone{\pgfmathresult}%
+ \endgroup%
+ \edef#1{\pgfmathresult}%
}
% \pgfmathdeclarerandomlist
@@ -209,24 +212,24 @@
% #2 - a list of comma separated elements.
%
\def\pgfmathdeclarerandomlist#1#2{%
- \def\pgfmath@randomlistname{#1}%
- \begingroup%
- \c@pgfmath@counta=1\relax%
- % {} is a possible random element so (locally)
- % redefine \pgfmath@empty.
- \def\pgfmath@empty{pgfmath@empty}%
- \expandafter\pgfmath@scanrandomlist#2{pgfmath@empty}}
+ \def\pgfmath@randomlistname{#1}%
+ \begingroup%
+ \c@pgfmath@counta=1\relax%
+ % {} is a possible random element so (locally)
+ % redefine \pgfmath@empty.
+ \def\pgfmath@empty{pgfmath@empty}%
+ \expandafter\pgfmath@scanrandomlist#2{pgfmath@empty}}
\def\pgfmath@scanrandomlist#1{%
- \def\pgfmath@scanneditem{#1}%
- \ifx\pgfmath@scanneditem\pgfmath@empty%
- \advance\c@pgfmath@counta-1\relax%
- \expandafter\xdef\csname pgfmath@randomlist@\pgfmath@randomlistname\endcsname{\the\c@pgfmath@counta}%
- \endgroup%
- \else%
- \expandafter\gdef\csname pgfmath@randomlist@\pgfmath@randomlistname @\the\c@pgfmath@counta\endcsname{#1}%
- \advance\c@pgfmath@counta1\relax%
- \expandafter\pgfmath@scanrandomlist%
- \fi}
+ \def\pgfmath@scanneditem{#1}%
+ \ifx\pgfmath@scanneditem\pgfmath@empty%
+ \advance\c@pgfmath@counta-1\relax%
+ \expandafter\xdef\csname pgfmath@randomlist@\pgfmath@randomlistname\endcsname{\the\c@pgfmath@counta}%
+ \endgroup%
+ \else%
+ \expandafter\gdef\csname pgfmath@randomlist@\pgfmath@randomlistname @\the\c@pgfmath@counta\endcsname{#1}%
+ \advance\c@pgfmath@counta1\relax%
+ \expandafter\pgfmath@scanrandomlist%
+ \fi}
% \pgfmathrandomitem
%
@@ -236,8 +239,7 @@
% #2 - the name of the list.
%
\def\pgfmathrandomitem#1#2{%
- \pgfmath@ifundefined{pgfmath@randomlist@#2}{\pgfmath@error{Unknown random list `#2'}}{%
- \edef\pgfmath@randomlistlength{\csname pgfmath@randomlist@#2\endcsname}%
- \pgfmathrandominteger{\pgfmath@randomtemp}{1}{\pgfmath@randomlistlength}%
- \def#1{\csname pgfmath@randomlist@#2@\pgfmath@randomtemp\endcsname}}}
-
+ \pgfmath@ifundefined{pgfmath@randomlist@#2}{\pgfmath@error{Unknown random list `#2'}}{%
+ \edef\pgfmath@randomlistlength{\csname pgfmath@randomlist@#2\endcsname}%
+ \pgfmathrandominteger{\pgfmath@randomtemp}{1}{\pgfmath@randomlistlength}%
+ \def#1{\csname pgfmath@randomlist@#2@\pgfmath@randomtemp\endcsname}}}
diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.round.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.round.code.tex
index 07f7b8b6d90..4bd05c18c41 100644
--- a/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.round.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.round.code.tex
@@ -13,111 +13,111 @@
% round function. Uses asymmetric half-up rounding.
%
-\pgfmathdeclarefunction{round}{1}{%
- \begingroup%
- \expandafter\pgfmath@x#1pt\relax%
- \afterassignment\pgfmath@xa%
- \expandafter\c@pgfmath@counta\the\pgfmath@x\relax%
- \pgfmath@xb\pgfmath@x%
- \ifdim\pgfmath@xb<0pt\relax%
- \ifdim\pgfmath@xa<0.5pt\relax%
- \else%
- \advance\c@pgfmath@counta-1\relax%
- \fi%
- \else%
- \ifdim\pgfmath@xa<0.5pt\relax%
- \else%
- \advance\c@pgfmath@counta1\relax%
- \fi%
- \fi%
- \pgfmath@returnone\the\c@pgfmath@counta pt%
- \endgroup%
+\pgfmathdeclarefunction{round}{1}{%
+ \begingroup%
+ \expandafter\pgfmath@x#1pt\relax%
+ \afterassignment\pgfmath@xa%
+ \expandafter\c@pgfmath@counta\the\pgfmath@x\relax%
+ \pgfmath@xb\pgfmath@x%
+ \ifdim\pgfmath@xb<0pt\relax%
+ \ifdim\pgfmath@xa<0.5pt\relax%
+ \else%
+ \advance\c@pgfmath@counta-1\relax%
+ \fi%
+ \else%
+ \ifdim\pgfmath@xa<0.5pt\relax%
+ \else%
+ \advance\c@pgfmath@counta1\relax%
+ \fi%
+ \fi%
+ \pgfmath@returnone\the\c@pgfmath@counta pt%
+ \endgroup%
}%
% floor function.
%
-\pgfmathdeclarefunction{floor}{1}{%
- \begingroup%
- \expandafter\pgfmath@x#1pt\relax%
- \afterassignment\pgfmathfloor@collect@remainder%
- \expandafter\c@pgfmath@counta\the\pgfmath@x\pgfmath@%
- \expandafter\pgfmath@x#1pt\relax%
- \ifdim\pgfmath@x<0pt\relax%
- \ifdim\pgfmathfloor@remainder>0pt
- \advance\c@pgfmath@counta by -1\relax%
- \else
- % ok, we stripped only '0'.
- \fi
- \fi%
- \pgfmath@x\c@pgfmath@counta pt\relax%
- \pgfmath@returnone\pgfmath@x%
- \endgroup%
+\pgfmathdeclarefunction{floor}{1}{%
+ \begingroup%
+ \expandafter\pgfmath@x#1pt\relax%
+ \afterassignment\pgfmathfloor@collect@remainder%
+ \expandafter\c@pgfmath@counta\the\pgfmath@x\pgfmath@%
+ \expandafter\pgfmath@x#1pt\relax%
+ \ifdim\pgfmath@x<0pt\relax%
+ \ifdim\pgfmathfloor@remainder>0pt
+ \advance\c@pgfmath@counta by -1\relax%
+ \else
+ % ok, we stripped only '0'.
+ \fi
+ \fi%
+ \pgfmath@x\c@pgfmath@counta pt\relax%
+ \pgfmath@returnone\pgfmath@x%
+ \endgroup%
}%
\def\pgfmathfloor@collect@remainder#1\pgfmath@{%
- \def\pgfmathfloor@remainder{#1}%
- \ifx\pgfmathfloor@remainder\pgfutil@empty
- \def\pgfmathfloor@remainder{0}%
- \fi
+ \def\pgfmathfloor@remainder{#1}%
+ \ifx\pgfmathfloor@remainder\pgfutil@empty
+ \def\pgfmathfloor@remainder{0}%
+ \fi
}%
% ceil function.
%
-\pgfmathdeclarefunction{ceil}{1}{%
- \begingroup%
- \expandafter\pgfmath@x#1pt\relax%
- \afterassignment\pgfmath@gobbletilpgfmath@%
- \expandafter\c@pgfmath@counta\the\pgfmath@x\relax\pgfmath@%
- \pgfmath@y\pgfmath@x%
- \advance\pgfmath@y-\c@pgfmath@counta pt\relax%
- \pgfmath@x\c@pgfmath@counta pt\relax%
- \ifdim\pgfmath@y>0pt\relax%
- \advance\pgfmath@x1pt\relax%
- \fi%
- \pgfmath@returnone\pgfmath@x%
- \endgroup%
+\pgfmathdeclarefunction{ceil}{1}{%
+ \begingroup%
+ \expandafter\pgfmath@x#1pt\relax%
+ \afterassignment\pgfmath@gobbletilpgfmath@%
+ \expandafter\c@pgfmath@counta\the\pgfmath@x\relax\pgfmath@%
+ \pgfmath@y\pgfmath@x%
+ \advance\pgfmath@y-\c@pgfmath@counta pt\relax%
+ \pgfmath@x\c@pgfmath@counta pt\relax%
+ \ifdim\pgfmath@y>0pt\relax%
+ \advance\pgfmath@x1pt\relax%
+ \fi%
+ \pgfmath@returnone\pgfmath@x%
+ \endgroup%
}%
% int function
%
\pgfmathdeclarefunction{int}{1}{%
- \begingroup%
- \expandafter\pgfmathint@@#1.\pgfmath@stop
- \pgfmath@smuggleone\pgfmathresult%
- \endgroup}
+ \begingroup%
+ \expandafter\pgfmathint@@#1.\pgfmath@stop
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup}
\def\pgfmathint@@#1.#2\pgfmath@stop{%
- \def\pgfmath@temp{#1}%
- \ifx\pgfmath@temp\pgfmath@empty%
- \def\pgfmathresult{0}%
- \else%
- \pgfmath@in@{#1}{+-+0-0}%
- \ifpgfmath@in@
- \def\pgfmathresult{0}%
- \else%
- \def\pgfmathresult{#1}%
- \fi%
- \fi}
+ \def\pgfmath@temp{#1}%
+ \ifx\pgfmath@temp\pgfmath@empty%
+ \def\pgfmathresult{0}%
+ \else%
+ \pgfmath@in@{#1}{+-+0-0}%
+ \ifpgfmath@in@
+ \def\pgfmathresult{0}%
+ \else%
+ \def\pgfmathresult{#1}%
+ \fi%
+ \fi}
% frac function.
%
-\pgfmathdeclarefunction{frac}{1}{%
- \begingroup%
- \expandafter\pgfmathfrac@@#1.\pgfmath@stop%
- \pgfmath@smuggleone\pgfmathresult%
- \endgroup}
+\pgfmathdeclarefunction{frac}{1}{%
+ \begingroup%
+ \expandafter\pgfmathfrac@@#1.\pgfmath@stop%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup}
\def\pgfmathfrac@@#1.{%
- \pgfmath@ifnextchar\pgfmath@stop{\def\pgfmathresult{0.0}\pgfmath@gobbleone}{\pgfmathfrac@@@}%
+ \pgfmath@ifnextchar\pgfmath@stop{\def\pgfmathresult{0.0}\pgfmath@gobbleone}{\pgfmathfrac@@@}%
}
\def\pgfmathfrac@@@#1.\pgfmath@stop{\def\pgfmathresult{0.#1}}
% real function.
%
\pgfmathdeclarefunction{real}{1}{%
- \begingroup%
- \pgfmath@x=#1pt\relax%
- \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@x}}%
- \pgfmath@smuggleone\pgfmathresult%
- \endgroup%
+ \begingroup%
+ \pgfmath@x=#1pt\relax%
+ \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@x}}%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
}
diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.trigonometric.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.trigonometric.code.tex
index aa98934e807..76b58bc0f16 100644
--- a/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.trigonometric.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.trigonometric.code.tex
@@ -9,7 +9,7 @@
% This file defines the trigonometric functions/functions.
%
-% Much of this file is based on ideas and code (particularly
+% Much of this file is based on ideas and code (particularly
% the old \pgfcoremath.code.tex) due to Till Tantau.
%
% Version 1.414213 29/9/2007
@@ -19,25 +19,25 @@
\pgfmathdeclarefunction{pi}{0}{\def\pgfmathresult{3.141592654}}
\pgfkeys{
- /pgf/trig format/.is choice,
- % attention: the luamath library will hook into these code keys.
- /pgf/trig format/deg/.code={\def\pgfmath@trig@format@choice{0}},
- /pgf/trig format/rad/.code={\def\pgfmath@trig@format@choice{1}},
- /pgf/trig format/deg,
+ /pgf/trig format/.is choice,
+ % attention: the luamath library will hook into these code keys.
+ /pgf/trig format/deg/.code={\def\pgfmath@trig@format@choice{0}},
+ /pgf/trig format/rad/.code={\def\pgfmath@trig@format@choice{1}},
+ /pgf/trig format/deg,
}
% Executes #1 if 'trig format=deg' and #2 otherwise.
\def\pgfmathiftrigonometricusesdeg#1#2{%
- \if0\pgfmath@trig@format@choice
- #1%
- \else
- #2%
- \fi
+ \if0\pgfmath@trig@format@choice
+ #1%
+ \else
+ #2%
+ \fi
}%
-% \pgfmathradians
-% (for comptability with 1.18 beta, will be deprecated)
-%
+% \pgfmathradians
+% (for compatibility with 1.18 beta, will be deprecated)
+%
% Convert #1 from radians to degrees (accurate to 1 deg).
%
\pgfmathdeclarefunction{radians}{1}{%
@@ -49,13 +49,13 @@
}%
% \pgfmathdeg
-%
+%
% Convert #1 from radians to degrees.
%
-\pgfmathdeclarefunction{deg}{1}{%
+\pgfmathdeclarefunction{deg}{1}{%
\begingroup%
\expandafter\pgfmath@x#1pt\relax%
- \pgfmath@scale@rad@to@deg\pgfmath@x
+ \pgfmath@scale@rad@to@deg\pgfmath@x
\pgfmath@returnone\pgfmath@x%
\endgroup%
}%
@@ -65,24 +65,24 @@
}%
% \pgfmathrad
-%
+%
% Convert #1 from degrees to radians.
%
-\pgfmathdeclarefunction{rad}{1}{%
+\pgfmathdeclarefunction{rad}{1}{%
\begingroup%
\expandafter\pgfmath@x#1pt\relax%
- \pgfmath@scale@deg@to@rad\pgfmath@x
+ \pgfmath@scale@deg@to@rad\pgfmath@x
\pgfmath@returnone\pgfmath@x%
\endgroup%
}%
\def\pgfmath@scale@deg@to@rad#1{%
- #1=3.14159#1%
+ #1=3.14159#1%
\divide#1180\relax%
}%
% \pgfmathsin
-%
+%
% Calculate the sine of #1 (in degrees).
%
\pgfmathdeclarefunction{sin}{1}{%
@@ -91,10 +91,10 @@
%
\begingroup%
\expandafter\pgfmath@x#1pt\relax%
- \if1\pgfmath@trig@format@choice
- % trig format=rad
- \pgfmath@scale@rad@to@deg\pgfmath@x
- \fi
+ \if1\pgfmath@trig@format@choice
+ % trig format=rad
+ \pgfmath@scale@rad@to@deg\pgfmath@x
+ \fi
\advance\pgfmath@x-90pt\relax%
\afterassignment\pgfmath@gobbletilpgfmath@
\expandafter\c@pgfmath@counta\the\pgfmath@x\relax\pgfmath@
@@ -128,7 +128,7 @@
}
% \pgfmathcos
-%
+%
% Calculate the cosine of #1 (in degrees).
%
\pgfmathdeclarefunction{cos}{1}{%
@@ -137,12 +137,12 @@
%
\begingroup%
\expandafter\pgfmath@x#1pt\relax%
- \if1\pgfmath@trig@format@choice
- % trig format=rad
- \pgfmath@scale@rad@to@deg\pgfmath@x
- \fi
+ \if1\pgfmath@trig@format@choice
+ % trig format=rad
+ \pgfmath@scale@rad@to@deg\pgfmath@x
+ \fi
\afterassignment\pgfmath@gobbletilpgfmath@%
- \expandafter\c@pgfmath@counta\the\pgfmath@x\relax\pgfmath@%
+ \expandafter\c@pgfmath@counta\the\pgfmath@x\relax\pgfmath@%
\divide\c@pgfmath@counta360\relax%
\multiply\c@pgfmath@counta-360\relax%
\advance\pgfmath@x\c@pgfmath@counta pt\relax%
@@ -173,7 +173,7 @@
}
% \pgfmathsincos
-%
+%
% Calculate the sin and cosine of #1 (in degrees).
%
\def\pgfmathsincos#1{%
@@ -186,7 +186,7 @@
}
% \pgfmathtan
-%
+%
% Calculate the tangent of #1 (in degrees).
%
\pgfmathdeclarefunction{tan}{1}{%
@@ -203,16 +203,16 @@
}
% \pgfmathcosec
-%
+%
% Calculate the cosec of #1 (in degrees).
%
-\pgfmathdeclarefunction{cosec}{1}{%
+\pgfmathdeclarefunction{cosec}{1}{%
\expandafter\pgfmathsin@\expandafter{#1}%
\pgfmathreciprocal@{\pgfmathresult}%
}
% \pgfmathsec
-%
+%
% Calculate the sec of #1 (in degrees).
%
\pgfmathdeclarefunction{sec}{1}{%
@@ -221,10 +221,10 @@
}
% \pgfmathcot
-%
+%
% Calculate the cotangent of #1 (in degrees).
%
-\pgfmathdeclarefunction{cot}{1}{%
+\pgfmathdeclarefunction{cot}{1}{%
\begingroup%
\edef\pgfmath@temparg{#1}%
\pgfmathsin@{\pgfmath@temparg}%
@@ -262,10 +262,10 @@
\ifdim\pgfmath@xa<0pt\relax%
\pgfmath@x-\pgfmath@x%
\fi%
- \if1\pgfmath@trig@format@choice
- % trig format=rad
- \pgfmath@scale@deg@to@rad\pgfmath@x
- \fi
+ \if1\pgfmath@trig@format@choice
+ % trig format=rad
+ \pgfmath@scale@deg@to@rad\pgfmath@x
+ \fi
\pgfmath@returnone\pgfmath@x%
\endgroup%
}
@@ -301,7 +301,7 @@
% \pgfmathacos
%
% The acos of #1
-%
+%
\pgfmathdeclarefunction{acos}{1}{%
\begingroup%
\pgfmath@x#1pt\relax%
@@ -318,10 +318,10 @@
\pgfmath@x-\pgfmath@x%
\advance\pgfmath@x by180pt\relax%
\fi%
- \if1\pgfmath@trig@format@choice
- % trig format=rad
- \pgfmath@scale@deg@to@rad\pgfmath@x
- \fi
+ \if1\pgfmath@trig@format@choice
+ % trig format=rad
+ \pgfmath@scale@deg@to@rad\pgfmath@x
+ \fi
\pgfmath@returnone\pgfmath@x%
\endgroup%
}
@@ -351,10 +351,10 @@
\ifdim\pgfmath@xa<0pt\relax%
\pgfmath@x-\pgfmath@x%
\fi%
- \if1\pgfmath@trig@format@choice
- % trig format=rad
- \pgfmath@scale@deg@to@rad\pgfmath@x
- \fi
+ \if1\pgfmath@trig@format@choice
+ % trig format=rad
+ \pgfmath@scale@deg@to@rad\pgfmath@x
+ \fi
\pgfmath@returnone\pgfmath@x%
\endgroup%
}
@@ -362,8 +362,8 @@
\pgfmathdeclarefunction{atan2}{2}{%
% Note: first parameter is y (!), second is x (!)
\begingroup%
- \let\pgfmath@trig@format@choice@@=\pgfmath@trig@format@choice
- \def\pgfmath@trig@format@choice{0}%
+ \let\pgfmath@trig@format@choice@@=\pgfmath@trig@format@choice
+ \def\pgfmath@trig@format@choice{0}%
\pgfmath@y=#1pt\relax%
\ifdim\pgfmath@y<0pt\relax%
\pgfmath@y=-\pgfmath@y%
@@ -402,12 +402,12 @@
\pgfmath@x=-\pgfmath@x%
\fi%
\fi%
- \if1\pgfmath@trig@format@choice@@
- % trig format=rad
- \pgfmath@scale@deg@to@rad\pgfmath@x
- \fi
+ \if1\pgfmath@trig@format@choice@@
+ % trig format=rad
+ \pgfmath@scale@deg@to@rad\pgfmath@x
+ \fi
\pgfmath@returnone\pgfmath@x%
- \endgroup%
+ \endgroup%
}
% This is needed since \pgfmathatan2 is not a legal macro name
@@ -557,7 +557,7 @@
\pgfmath@def{cosfrac}{94}{0.72862} \pgfmath@def{cosfrac}{95}{0.72499}
\pgfmath@def{cosfrac}{96}{0.72138} \pgfmath@def{cosfrac}{97}{0.71779}
\pgfmath@def{cosfrac}{98}{0.71421} \pgfmath@def{cosfrac}{99}{0.71065}
-\pgfmath@def{cosfrac}{100}{0.70710}
+\pgfmath@def{cosfrac}{100}{0.70710}
% Oh No! Some really loooooong tables.
\pgfmath@def{atan}{0}{0.00000} \pgfmath@def{atan}{1}{0.05729}
@@ -1060,8 +1060,8 @@
\pgfmath@def{atan}{994}{44.82759} \pgfmath@def{atan}{995}{44.85640}
\pgfmath@def{atan}{996}{44.88517} \pgfmath@def{atan}{997}{44.91392}
\pgfmath@def{atan}{998}{44.94264} \pgfmath@def{atan}{999}{44.97133}
-\pgfmath@def{atan}{1000}{45.00000}
-
+\pgfmath@def{atan}{1000}{45.00000}
+
\pgfmath@def{acos}{0}{90.00000} \pgfmath@def{acos}{1}{89.94270}
\pgfmath@def{acos}{2}{89.88540} \pgfmath@def{acos}{3}{89.82811}
\pgfmath@def{acos}{4}{89.77081} \pgfmath@def{acos}{5}{89.71352}
diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmathode.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmathode.code.tex
index d8837897558..cb3d0d26ca8 100644
--- a/Master/texmf-dist/tex/generic/pgf/math/pgfmathode.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/math/pgfmathode.code.tex
@@ -36,12 +36,12 @@
%**********************************************************************
% Numerically solve a differential system with 1st order Runge-Kutta
-% (Euler method)
+% (Euler method)
% dq1/dt = f1(t,q1,q2,...,qN)
% dq2/dt = f2(t,q1,q2,...,qN)
% ...
% dqN/dt = fN(t,q1,q2,...,qN)
-%
+%
% #1: A pgf array where the solution will be stored.
% At the end:
% #1 -> {{t(0),q1(t(0)),q2(t(0)),...,qN(t(0))},
@@ -58,7 +58,7 @@
% * First order example: dq/dt = -q + 5 with IC=(t=0,q(0)=0)
% \pgfmathodeRKI{\Sol}{{-\Sol[1]+5}}{{0,0}}{3.5}{100}
% * Second order example: {dq1/dt=q2, dq2/dt=-q2/2-sin(q1)} (damped
-% pendulum)
+% pendulum)
% \pgfmathodeRKI{\Sol}{{\Sol[2],-\Sol[2]/2-sin(deg(\Sol[1]))}}%
% {{0,-1,5}}{15}{50}
@@ -71,8 +71,8 @@
% The set of rhs {f1(t,q1,q2,...,qN),...,fN(t,q1,q2,...,qN)} is
% given in terms of #1[0],#1[1],...,#1[N]. We need to transform to
% #1[\pgfmathode@timeindex][0],...,#1[\pgfmathode@timeindex][N], that is
- % add [\pgfmathode@timeindex] after every occurence of #1 in #2.
- % No need to brace #2 since it is already surounded by braces. The
+ % add [\pgfmathode@timeindex] after every occurrence of #1 in #2.
+ % No need to brace #2 since it is already surrounded by braces. The
% result is stored in \pgfmathode@func
\pgfmathode@addindextofunc[#1]#2%
% Set time step. Actually the number of time steps is #5-1, so we
@@ -93,9 +93,9 @@
\foreach \pgfmathode@funcindex in {1,...,\pgfmathode@dimfunc} {%
% The RKI algorithm
% qk[t(i)] = Deltat*fk(t(i-1),q1(t(i-1)),...qN(t(i-1))) +
- % qk[t(i-1)]
- % Note: this part can be really slow due to array managment in
- % pgfmath.
+ % qk[t(i-1)]
+ % Note: this part can be really slow due to array management in
+ % pgfmath.
% TODO: find a better way (at least inside this loop)
\pgfmathparse{%
\pgfmathode@Deltat*(\pgfmathode@func[\pgfmathode@funcindex-1])+
@@ -132,7 +132,7 @@
% Start the function loop
\foreach \pgfmathode@funcindex in {1,...,\pgfmathode@dimfunc} {%
% The RKIV algorithm
- % qk[t(i)] = qk[t(i-1)] +
+ % qk[t(i)] = qk[t(i-1)] +
% (1/6) * (j1k + 2j2k + 2j3k + j4k)
% where j1k = fk(t(i-1),q1(t(i-1)),...qN(t(i-1))) * Deltat
% j2k = fk(t(i-1)+.5*Deltat,
@@ -175,4 +175,4 @@
\endgroup}
-\endinput \ No newline at end of file
+\endinput
diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex
index 0ede2314cfe..f9afe04d72d 100644
--- a/Master/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex
@@ -24,7 +24,7 @@
\fi
\pgfmath@parse@next}
-\def\pgfmath@catcodes{% Maybe unecessary.
+\def\pgfmath@catcodes{% Maybe unnecessary.
\catcode`\==12 %
\catcode`\,=12 %
\catcode`\|=12 %
@@ -36,23 +36,23 @@
\pgfmath@catcodes
\pgfmath@quickparsetrue
\pgfmathparse@}
-
+
\def\pgfmathparse@#1{%
- % No (math) units yet.
+ % No (math) units yet.
\global\pgfmathunitsdeclaredfalse
\global\pgfmathmathunitsdeclaredfalse
- % Expand expression so any reamining CSs are registers
+ % Expand expression so any remaining CSs are registers
% or box dimensions (i.e. |\wd|, |\ht|, |\dp|).
\edef\pgfmath@expression{#1}%
- %
- \expandafter\pgfmathparse@trynumber@loop\pgfmath@expression\pgfmath@parse@stop
- %
- % this here is the _real_ parser. it is invoked by
- % \pgfmathparse@trynumber@loop if that says "this is no number"
- %\pgfmathparse@@\pgfmath@parse@stop%
+ %
+ \expandafter\pgfmathparse@trynumber@loop\pgfmath@expression\pgfmath@parse@stop
+ %
+ % this here is the _real_ parser. it is invoked by
+ % \pgfmathparse@trynumber@loop if that says "this is no number"
+ %\pgfmathparse@@\pgfmath@parse@stop%
}
-\def\pgfmath@parse@stop{\pgfmath@parse@stop}% equals only itsself
+\def\pgfmath@parse@stop{\pgfmath@parse@stop}% equals only itself
\def\pgfmathparse@trynumber@token{numeric}
\begingroup
@@ -66,52 +66,52 @@
%
% #1 a single token
\def\pgfmathparse@trynumber@loop{%
- \futurelet\pgfmath@token@let\pgfmathparse@trynumber@loop@
+ \futurelet\pgfmath@token@let\pgfmathparse@trynumber@loop@
}%
\def\pgfmathparse@trynumber@loop@#1{%
- \ifx\pgfmath@token@let\pgf@let@space@token
- % Hm. we found a white space... and we have no support for
- % trimming. That means we have to assume that the white space
- % occurred somewhere in the middle - and fall back to the
- % expensive method.
- \def\pgfmath@parse@next{\pgfmathparse@@#1}%
- \else
- \ifx\pgfmath@token@let\bgroup%
- % oh! We found '{' #1.
- % Well, these braces appear to be special; fall back to
- % the complicated routine...
- \let\pgfmath@parse@next=\pgfmathparse@@
- \else
- \ifx\pgfmath@token@let\pgfmath@parse@stop
- % Ah: we have passed the check! The expression consists only
- % of 0123456789. , so do not parse anything and return it
- % as-is!
- \let\pgfmath@parse@next=\pgfmathparse@expression@is@number
- \else
- \expandafter\ifx\csname pgfmath@token@\pgfmathparse@trynumber@token @\string#1\endcsname\relax%
- % hm. It is none of 0123456789.
- \let\pgfmath@parse@next=\pgfmathparse@@
- \else
- % continue... we only found one of 0123456789. so
- % far...
- \let\pgfmath@parse@next=\pgfmathparse@trynumber@loop
- \fi
- \fi
- \fi
- \fi
- \pgfmath@parse@next
+ \ifx\pgfmath@token@let\pgf@let@space@token
+ % Hm. we found a white space... and we have no support for
+ % trimming. That means we have to assume that the white space
+ % occurred somewhere in the middle - and fall back to the
+ % expensive method.
+ \def\pgfmath@parse@next{\pgfmathparse@@#1}%
+ \else
+ \ifx\pgfmath@token@let\bgroup%
+ % oh! We found '{' #1.
+ % Well, these braces appear to be special; fall back to
+ % the complicated routine...
+ \let\pgfmath@parse@next=\pgfmathparse@@
+ \else
+ \ifx\pgfmath@token@let\pgfmath@parse@stop
+ % Ah: we have passed the check! The expression consists only
+ % of 0123456789. , so do not parse anything and return it
+ % as-is!
+ \let\pgfmath@parse@next=\pgfmathparse@expression@is@number
+ \else
+ \expandafter\ifx\csname pgfmath@token@\pgfmathparse@trynumber@token @\string#1\endcsname\relax%
+ % hm. It is none of 0123456789.
+ \let\pgfmath@parse@next=\pgfmathparse@@
+ \else
+ % continue... we only found one of 0123456789. so
+ % far...
+ \let\pgfmath@parse@next=\pgfmathparse@trynumber@loop
+ \fi
+ \fi
+ \fi
+ \fi
+ \pgfmath@parse@next
}%
\def\pgfmathparse@expression@is@number{%
- \let\pgfmathresult=\pgfmath@expression
+ \let\pgfmathresult=\pgfmath@expression
\pgfmath@smuggleone\pgfmathresult%
\endgroup
\ignorespaces
}%
\def\pgfmathparse@@#1\pgfmath@parse@stop{%
% We are inside a group (opened in |\pgfmathparse| or
- % |\pgfmathqparse|).
- % Stuff for calc compatiability.
+ % |\pgfmathqparse|).
+ % Stuff for calc compatibility.
\let\real=\pgfmath@calc@real
\let\minof=\pgfmath@calc@minof
\let\maxof=\pgfmath@calc@maxof
@@ -141,7 +141,7 @@
\let\pgfmathpostparse=\relax
-% For compatiability with older version.
+% For compatibility with older version.
%
\def\pgfmathscaleresult{%
\ifpgfmathunitsdeclared
@@ -178,7 +178,7 @@
\pgfmath@next%
}%
-% Stuff for compatability with the calc package.
+% Stuff for computability with the calc package.
%
\def\pgfmath@calc@real#1{#1}
\def\pgfmath@calc@minof#1#2{min(#1,#2)}
@@ -208,14 +208,14 @@
\edef\pgfmath@char@hash{\the\pgfmath@toks}
\def\pgfmath@tokens@make#1#2{%
- % Defines for each token or balenced text in |#2| a control sequence
+ % Defines for each token or balanced text in |#2| a control sequence
% |\pgfmath@token@<#1>@\string<one token from #2>| and stores |#2|
% in it.
\def\pgfmath@prefix{#1}%
% Note the empty group |{}| at the end that ends the loop in
% |\pgfmath@token@@make|.
\expandafter\pgfmath@tokens@@make#2{}}
-
+
\def\pgfmath@tokens@@make#1{%
\def\pgfmath@token{#1}%
\ifx\pgfmath@token\pgfmath@empty
@@ -265,7 +265,7 @@
\let\pgfmath@parse@nobgroup@after=#2%
\futurelet\pgfmath@token@let%
\pgfmath@parse@@ifbgroup}
-
+
\def\pgfmath@parse@@ifbgroup{%
\ifx\pgfmath@token@let\bgroup
\let\pgfmath@parse@next=\pgfmath@parse@@@ifbgroup
@@ -305,9 +305,9 @@
\def\pgfmath@parse@@operand{%
\pgfmath@parse@ifbgroup{\pgfmath@parse@@operand}{\pgfmath@parse@@operand@}}
-% An operand is
+% An operand is
% * |+| (unary plus),
-% * |-| (unary minus),
+% * |-| (unary minus),
% * a prefix operator
\def\pgfmath@parse@@operand@#1{%
\def\pgfmath@token{#1}%
@@ -396,8 +396,8 @@
% 4. A box dimension (e.g., \wd\mybox).
% 5. A box dimension preceded by a number or a count register.
% 6. Scientific notation (e.g., 1.234567e-10).
-% 7. A binary, hexadeciaml, or octal number.
-%
+% 7. A binary, hexadecimal, or octal number.
+%
\def\pgfmath@parse@number{\pgfmath@parse@ifbgroup{\pgfmath@parse@number}{\pgfmath@parse@number@}}
\def\pgfmath@parse@number@#1{%
\let\pgfmath@token=\pgfmath@token@next%
@@ -430,7 +430,7 @@
\pgfmath@count=\pgfmath@token%
\expandafter\def\expandafter\pgfmath@number\expandafter{\the\pgfmath@count}%
\expandafter\ifcat\pgfmath@token@next\relax%
- % A CS following a count register should be \wd, \ht or \dp.
+ % A CS following a count register should be \wd, \ht or \dp.
\let\pgfmath@parse@next=\pgfmath@parse@number%
\else%
\let\pgfmathresult=\pgfmath@number%
@@ -464,7 +464,7 @@
\expandafter\ifx\csname pgfmath@token@mathunit@\pgfmath@token\expandafter\string\pgfmath@token@next\endcsname\relax%
% ...none of the above...
\ifx\pgfmath@base\pgfmath@empty%
- \let\pgfmathresult=\pgfmath@number%
+ \let\pgfmathresult=\pgfmath@number%
\else%
\ifx\pgfmath@number\pgfmath@char@zero%
\let\pgfmathresult=\pgfmath@number%
@@ -491,7 +491,7 @@
\let\pgfmath@parse@next=\pgfmath@parse@base%
\fi%
\else% ... and here, it is the exponent characters.
- \let\pgfmath@parse@next=\pgfmath@parse@exponent%
+ \let\pgfmath@parse@next=\pgfmath@parse@exponent%
\fi%
\else% ...but here it is units.
\global\pgfmathunitsdeclaredtrue%
@@ -555,7 +555,7 @@
\expandafter\def\expandafter\pgfmath@number\expandafter{\the\pgfmath@count}%
\def\pgfmath@token@next{#1}%
\expandafter\ifcat\pgfmath@token@next\relax%
- % A CS following a count register should be \wd, \ht or \dp.
+ % A CS following a count register should be \wd, \ht or \dp.
\let\pgfmath@parse@next=\pgfmath@parse@number%
\else%
\let\pgfmathresult=\pgfmath@number%
@@ -579,7 +579,7 @@
\pgfmath@parse@@operator%
}
-% Parse binary or hexadecimal numbers (octal numbers done elsehwere).
+% Parse binary or hexadecimal numbers (octal numbers done elsewhere).
%
\def\pgfmath@parse@base{%
\ifnum\pgfmath@base=2\relax%
@@ -596,7 +596,7 @@
\let\pgfmath@number=\pgfmath@empty%
\expandafter\pgfmath@parse@next\pgfmath@token@next%
}
-
+
\def\pgfmath@parse@binary#1{%
\expandafter\ifx\csname pgfmath@token@binary@#1\endcsname\relax%
\expandafter\pgfmathbasetobase\expandafter\pgfmathresult\expandafter{\pgfmath@number}{2}{10}%
@@ -622,7 +622,7 @@
\fi%
\pgfmath@parse@next%
}
-
+
% Parse a function.
%
\def\pgfmath@parse@function{\pgfmath@parse@ifbgroup{\pgfmath@parse@function}{\pgfmath@parse@@function}}
@@ -645,7 +645,7 @@
\expandafter\def\expandafter\pgfmath@function\expandafter{\pgfmath@function#1}%
\let\pgfmath@parse@next=\pgfmath@parse@function@%
\fi%
- \else% It is from from A-Z, a-z, or _.
+ \else% It is from A-Z, a-z, or _.
\edef\pgfmath@function{\pgfmath@function#1}%
\let\pgfmath@parse@next=\pgfmath@parse@function@%
\fi%
@@ -683,7 +683,7 @@
\pgfmath@parse@ifbgroup{\pgfmath@parse@@operator@@}{\pgfmath@parse@@operator@@}}%
\def\pgfmath@parse@@operator@@#1{% ...and second token.
\def\pgfmath@token@next{#1}%
- \pgfmath@parse@@@operator}
+ \pgfmath@parse@@@operator}
\def\pgfmath@parse@@@operator{%
\expandafter\ifx\csname pgfmath@operator@\pgfmath@token\expandafter\string\pgfmath@token@next\endcsname\relax%
@@ -770,10 +770,10 @@
%
\def\pgfmath@operator@@@process{% Process an operator.
\pgfmath@stack@pop@operation\pgfmath@@operator%
- \pgfmath@stack@pop@operand\pgfmath@operand@a%
+ \pgfmath@stack@pop@operand\pgfmath@operand@a%
\ifcase\csname pgfmath@operation@\pgfmath@@operator @arity\endcsname\relax%
% Zero arity operators (!).
- \or%
+ \or%
\pgfmath@operator@@@@process{\pgfmath@operand@a}%
\or%
\pgfmath@stack@pop@operand\pgfmath@operand@b%
@@ -781,7 +781,7 @@
\or%
\pgfmath@stack@pop@operand\pgfmath@operand@b%
\expandafter\pgfmath@operator@@@@process\expandafter%
- {\expandafter\pgfmath@operand@b\expandafter}\pgfmath@operand@a%
+ {\expandafter\pgfmath@operand@b\expandafter}\pgfmath@operand@a%
\else%
% No operators with more than tenary arity.
\fi%
@@ -807,7 +807,7 @@
\else%
\expandafter\pgfmath@function@@@@process\expandafter{\pgfmath@@operand}%
\fi%
- \fi%
+ \fi%
}
\def\pgfmath@function@@@@process{\csname pgfmath\pgfmath@@function @\endcsname}
@@ -834,7 +834,7 @@
\def\pgfmath@stack@pop@operation#1{%
\pgfmath@stack@pop\pgfmath@stack@operation{#1}%
\let\pgfmath@stack@operation@top=\pgfmath@stack@top}
-
+
% REMARK: This method will be overwritten by the FPU library. Please
% keep any changes consistent.
\def\pgfmath@stack@push@operand#1{%
@@ -844,11 +844,11 @@
\def\pgfmath@stack@pop@operand#1{%
\pgfmath@stack@pop\pgfmath@stack@operand{#1}%
\let\pgfmath@stack@operand@top=\pgfmath@stack@top}
-
+
% Declare an operator for the parser.
%
-% It is not recommended that new operators be created as
+% It is not recommended that new operators be created as
% the parser is not fully robust for arbitrary operators.
%
\def\pgfmathdeclareoperator#1#2#3#4#5{%
@@ -896,7 +896,7 @@
\pgfmathdeclareoperator{)}{@endgroup} {0}{postfix}{4}
\pgfmathdeclareoperator{\pgfmath@bgroup}{@startarray}{1}{prefix} {3}
-\pgfmathdeclareoperator{\pgfmath@egroup}{@endarray} {1}{postfix}{2}%
+\pgfmathdeclareoperator{\pgfmath@egroup}{@endarray} {1}{postfix}{2}%
% Special operators.
\pgfmathdeclareoperator{"}{}{1}{prefix}{1}
diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmathutil.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmathutil.code.tex
index 44d39c75b6a..d98ecb25d59 100644
--- a/Master/texmf-dist/tex/generic/pgf/math/pgfmathutil.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/math/pgfmathutil.code.tex
@@ -1,9 +1,9 @@
% Copyright 2007 Mark Wibrow
%
-% but subject to the LaTeX Project Public License
+% but subject to the LaTeX Project Public License
% (http://www.latex-project.org/lppl.txt)
%
-% and the GNU Public License
+% and the GNU Public License
% (http://www.gnu.org/licenses/gpl.txt)
%
@@ -21,30 +21,30 @@
% #2 - a control sequence.
%
\def\pgfmath@ensureregister#1#2{%
- \begingroup%
- \setbox0=\hbox\bgroup\begingroup% In case #2 is a defined macro. Unlikely, but you never know...
- \afterassignment\pgfmath@@ensureregister%
- \noexpand#20.0pt\let\pgfmath@temp\relax\relax\pgfmath@#2#1\pgfmath@}
+ \begingroup%
+ \setbox0=\hbox\bgroup\begingroup% In case #2 is a defined macro. Unlikely, but you never know...
+ \afterassignment\pgfmath@@ensureregister%
+ \noexpand#20.0pt\let\pgfmath@temp\relax\relax\pgfmath@#2#1\pgfmath@}
\def\pgfmath@@ensureregister#1#2\pgfmath@#3#4#5\pgfmath@{%
- \endgroup\egroup%
- \endgroup%
- \ifx#4c%
- \ifx#1.% Already a count register.
- \else%
- \csname newcount\endcsname#3% This gets round \outer in plain TeX.
- \fi%
- \else%
- \ifx#4d%
- \ifx\let#1% Already a dimen register.
- \else%
- \csname newdimen\endcsname#3%
- \fi%
- \fi%
- \fi%
+ \endgroup\egroup%
+ \endgroup%
+ \ifx#4c%
+ \ifx#1.% Already a count register.
+ \else%
+ \csname newcount\endcsname#3% This gets round \outer in plain TeX.
+ \fi%
+ \else%
+ \ifx#4d%
+ \ifx\let#1% Already a dimen register.
+ \else%
+ \csname newdimen\endcsname#3%
+ \fi%
+ \fi%
+ \fi%
}
-% Check registers exist. If not, create them.
+% Check registers exist. If not, create them.
%
\pgfmath@ensureregister{dimen}{\pgf@x}
\pgfmath@ensureregister{dimen}{\pgf@xa}
@@ -91,63 +91,63 @@
\let\pgfmath@tempcntb\pgfutil@tempcntb
% Now check if pgfutil and pgf@sys stuff exists. If it does, fine.
-% Just \let pgfmath versions. If not, define pgfmath versions (Arghhh).
+% Just \let pgfmath versions. If not, define pgfmath versions (Arghhh).
%
% \...ifnextchar
%
\ifx\pgfutil@ifnextchar\pgfmath@undefined%
- \long\def\pgfmath@ifnextchar#1#2#3{%
+ \long\def\pgfmath@ifnextchar#1#2#3{%
\let\pgfmath@reserved@d#1%
\def\pgfmath@reserved@a{#2}%
\def\pgfmath@reserved@b{#3}%
\futurelet\pgfmath@let@token\pgfmath@ifnch}
- \def\pgfmath@ifnch{%
- \ifx\pgfmath@let@token\pgfmath@sptoken%
- \let\pgfmath@reserved@c\pgfmath@xifnch%
- \else%
- \ifx\pgfmath@let@token\pgfmath@reserved@d%
- \let\pgfmath@reserved@c\pgfmath@reserved@a%
- \else%
- \let\pgfmath@reserved@c\pgfmath@reserved@b%
- \fi%
- \fi%
- \pgfmath@reserved@c}
- {%
- \def\:{\global\let\pgfmath@sptoken= } \:
- \def\:{\pgfmath@xifnch} \expandafter\gdef\: {\futurelet\pgfmath@let@token\pgfmath@ifnch}
- }%
+ \def\pgfmath@ifnch{%
+ \ifx\pgfmath@let@token\pgfmath@sptoken%
+ \let\pgfmath@reserved@c\pgfmath@xifnch%
+ \else%
+ \ifx\pgfmath@let@token\pgfmath@reserved@d%
+ \let\pgfmath@reserved@c\pgfmath@reserved@a%
+ \else%
+ \let\pgfmath@reserved@c\pgfmath@reserved@b%
+ \fi%
+ \fi%
+ \pgfmath@reserved@c}
+ {%
+ \def\:{\global\let\pgfmath@sptoken= } \:
+ \def\:{\pgfmath@xifnch} \expandafter\gdef\: {\futurelet\pgfmath@let@token\pgfmath@ifnch}
+ }%
\else%
- \let\pgfmath@ifnextchar\pgfutil@ifnextchar%
- % Still need to define \pgfmath@sptoken (cannot \let).
- {%
- \def\:{\global\let\pgfmath@sptoken= } \:
- }%
+ \let\pgfmath@ifnextchar\pgfutil@ifnextchar%
+ % Still need to define \pgfmath@sptoken (cannot \let).
+ {%
+ \def\:{\global\let\pgfmath@sptoken= } \:
+ }%
\fi%
% \...ifundefined
%
\ifx\pgfutil@ifundefined\pgfmath@undefined%
- \long\def\pgfmath@ifundefined#1{%
- \expandafter\ifx\csname#1\endcsname\relax%
- \expandafter\pgfmath@firstoftwo%
- \else%
- \expandafter\pgfmath@secondoftwo%
- \fi}%
+ \long\def\pgfmath@ifundefined#1{%
+ \expandafter\ifx\csname#1\endcsname\relax%
+ \expandafter\pgfmath@firstoftwo%
+ \else%
+ \expandafter\pgfmath@secondoftwo%
+ \fi}%
\else%
- \let\pgfmath@ifundefined\pgfutil@ifundefined%
+ \let\pgfmath@ifundefined\pgfutil@ifundefined%
\fi%
% \...selectfont
%
\ifx\pgfutil@selectfont\pgfmath@undefined%
- \ifx\selectfont\pgfmath@undefined%
- \let\pgfmath@selectfont\rm% Plain TeX and ConTeXt.
- \else%
- \let\pgfmath@selectfont\selectfont% LaTeX.
- \fi%
+ \ifx\selectfont\pgfmath@undefined%
+ \let\pgfmath@selectfont\rm% Plain TeX and ConTeXt.
+ \else%
+ \let\pgfmath@selectfont\selectfont% LaTeX.
+ \fi%
\else%
- \let\pgfmath@selectfont\pgfutil@selectfont%
+ \let\pgfmath@selectfont\pgfutil@selectfont%
\fi%
% New definition easier than fussing around with let.
@@ -163,43 +163,43 @@
%
\ifx\pgf@sys@tonumber\pgfmath@undefined%
{\catcode`\p=12\catcode`\t=12\gdef\Pgf@geT#1pt{#1}}
- \def\pgfmath@tonumber#1{\expandafter\Pgf@geT\the#1}
+ \def\pgfmath@tonumber#1{\expandafter\Pgf@geT\the#1}
\else%
- \let\pgfmath@tonumber\pgf@sys@tonumber%
+ \let\pgfmath@tonumber\pgf@sys@tonumber%
\fi%
% \PackageWarning and \PackageError
%
\ifx\PackageWarning\pgfmath@undefined
- \def\pgfmath@PackageWarning#1#2{\immediate\write-1{Package #1: Warning! #2.}}%
+ \def\pgfmath@PackageWarning#1#2{\immediate\write-1{Package #1: Warning! #2.}}%
\else%
- \let\pgfmath@PackageWarning\PackageWarning%
+ \let\pgfmath@PackageWarning\PackageWarning%
\fi%
\ifx\PackageError\pgfmath@undefined
- \def\pgfmath@PackageError#1#2#3{\errmessage{Package #1 Error: #2.}}%
+ \def\pgfmath@PackageError#1#2#3{\errmessage{Package #1 Error: #2.}}%
\else%
- \let\pgfmath@PackageError\PackageError%
+ \let\pgfmath@PackageError\PackageError%
\fi%
\def\pgfmath@error#1#2{%
- \pgfmath@PackageError{PGF Math}{%
- #1%
- \pgfutil@ifundefined{pgfmath@expression}{}{ (in '\pgfmath@expression')}%
- }{#2}%
+ \pgfmath@PackageError{PGF Math}{%
+ #1%
+ \pgfutil@ifundefined{pgfmath@expression}{}{ (in '\pgfmath@expression')}%
+ }{#2}%
}
\def\pgfmath@warning#1{%
- \pgfmath@PackageWarning{PGF Math}{%
- #1%
- \pgfutil@ifundefined{pgfmath@expression}{}{ (in '\pgfmath@expression')}%
- }%
+ \pgfmath@PackageWarning{PGF Math}{%
+ #1%
+ \pgfutil@ifundefined{pgfmath@expression}{}{ (in '\pgfmath@expression')}%
+ }%
}
% \pgfmath@pt
%
% Needed to test for 'pt' resulting from expansion using \the.
%
-{\catcode`\p=12\catcode`\t=12\gdef\PgfmaTh@PT{pt}}
+{\catcode`\p=12\catcode`\t=12\gdef\PgfmaTh@PT{pt}}
\edef\pgfmath@pt{\PgfmaTh@PT}%
% \pgfmath@empty
@@ -214,7 +214,7 @@
% \pgfmath@gobbletilpgfmath@
%
% Gobble stream until \pgfmath@ {which is undefined}.
-%
+%
\def\pgfmath@gobbletilpgfmath@#1\pgfmath@{}
\def\pgfmath@gobbleone#1{}%
@@ -231,17 +231,17 @@
%
\newif\ifpgfmathcontinueloop
\def\pgfmathloop#1\repeatpgfmathloop{%
- \def\pgfmathcounter{1}%
- \def\pgfmath@iterate{%
- #1\relax%
- {% Do this inside a group, just in case...
- \c@pgfmath@counta\pgfmathcounter%
- \advance\c@pgfmath@counta1\relax%
- \xdef\pgfmathloop@temp{\the\c@pgfmath@counta}%
- }%
- \edef\pgfmathcounter{\pgfmathloop@temp}%
- \expandafter\pgfmath@iterate\fi}%
- \pgfmath@iterate\let\pgfmath@iterate\relax}
+ \def\pgfmathcounter{1}%
+ \def\pgfmath@iterate{%
+ #1\relax%
+ {% Do this inside a group, just in case...
+ \c@pgfmath@counta\pgfmathcounter%
+ \advance\c@pgfmath@counta1\relax%
+ \xdef\pgfmathloop@temp{\the\c@pgfmath@counta}%
+ }%
+ \edef\pgfmathcounter{\pgfmathloop@temp}%
+ \expandafter\pgfmath@iterate\fi}%
+ \pgfmath@iterate\let\pgfmath@iterate\relax}
\let\repeatpgfmathloop\fi
\def\pgfmathbreakloop{\let\pgfmath@iterate\relax}%
@@ -251,7 +251,7 @@
%
% Changed by TT: made faster and simpler since it is used
% *heavily*. #1 must be something that can be assigned to a
-% dimension.
+% dimension.
%
\def\pgfmath@returnone#1\endgroup{%
\pgfmath@x#1%
@@ -269,6 +269,6 @@
% followed by \endgroup
%
\def\pgfmath@smuggleone#1\endgroup{%
- \expandafter\endgroup\expandafter\def\expandafter#1\expandafter{#1}}
+ \expandafter\endgroup\expandafter\def\expandafter#1\expandafter{#1}}
\let\pgfmathsmuggle=\pgfmath@smuggleone