summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.misc.code.tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2014-02-27 00:01:50 +0000
committerKarl Berry <karl@freefriends.org>2014-02-27 00:01:50 +0000
commit90ae413a94da014dbf7a6a8ab584f7c668483a5a (patch)
tree4e0528a2b2fb2004988e7fc804ea2f1354f1f5d5 /Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.misc.code.tex
parent800cc56380d1edfe567a6a66bef13e8950eb2b0c (diff)
pgf 3.0.0
git-svn-id: svn://tug.org/texlive/trunk@33057 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.misc.code.tex')
-rw-r--r--Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.misc.code.tex27
1 files changed, 24 insertions, 3 deletions
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 65460e4b3cc..e00786d7a37 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
@@ -160,6 +160,9 @@
\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%
+ \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%
@@ -191,7 +194,7 @@
\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\fi%
\pgfmath@returnone\pgfmath@x%
\endgroup}
@@ -263,6 +266,24 @@
\pgfmath@smuggleone\pgfmathresult\endgroup%
}
+% dim function: return dimension of an array
+% dim({1,2,3}) return 3
+% dim({{1,2,3},{4,5,6}}) return 2
+\pgfmathdeclarefunction{dim}{1}{%
+ \begingroup
+ \pgfmath@count=0\relax
+ \expandafter\pgfmath@dim@i\pgfutil@firstofone#1\pgfmath@token@stop
+ \edef\pgfmathresult{\the\pgfmath@count}%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup}
+
+\def\pgfmath@dim@i#1{%
+ \ifx\pgfmath@token@stop#1%
+ \else
+ \advance\pgfmath@count by 1\relax
+ \expandafter\pgfmath@dim@i
+ \fi}
+
% max function.
%
@@ -287,7 +308,7 @@
% For compatability with old code.
\def\pgfmathmax#1#2{%
- \pgfmathparse{getargs(#1,#2)}%
+ \pgfmathparse{#1,#2}%
\expandafter\pgfmathmax@\expandafter{\pgfmathresult}%
}
@@ -314,7 +335,7 @@
% For compatability with old code.
\def\pgfmathmin#1#2{%
- \pgfmathparse{getargs(#1,#2)}%
+ \pgfmathparse{#1,#2}%
\expandafter\pgfmathmin@\expandafter{\pgfmathresult}%
}