summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/pgfplots/pgfmathlogtest.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/latex/pgfplots/pgfmathlogtest.tex')
-rw-r--r--Master/texmf-dist/doc/latex/pgfplots/pgfmathlogtest.tex174
1 files changed, 162 insertions, 12 deletions
diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfmathlogtest.tex b/Master/texmf-dist/doc/latex/pgfplots/pgfmathlogtest.tex
index 8fbc889f526..86fa5795a87 100644
--- a/Master/texmf-dist/doc/latex/pgfplots/pgfmathlogtest.tex
+++ b/Master/texmf-dist/doc/latex/pgfplots/pgfmathlogtest.tex
@@ -20,9 +20,6 @@
\begin{document}
\maketitle
-Hier evaluiere ich logarithmen.
-
-\message{HIER GEHTS LOS!}%
\def\vgl#1#2{%
\begingroup
\message{COMPUTING LOG(#1)}%
@@ -45,8 +42,9 @@ Hier evaluiere ich logarithmen.
\def\normalize#1{%
\begingroup
\message{NORMALISING #1...}%
- \pgfmathnormalisedfloatingpoint#1\to\M\powten\E
- \[ #1 \mapsto \M\cdot 10^{\E} \]
+ \sciparse#1\to\M\powten\E
+ \sciparsesign{#1}\S\MM\EE
+ \[ #1 \mapsto \M \cdot 10^{\E}\quad \bigl( = \MM\cdot 10^{\EE}\quad [S=\S]\, \bigr) \]
\endgroup
}
@@ -66,7 +64,7 @@ Hier evaluiere ich logarithmen.
% log(6.241e-7)=\pgfmathlog{6.241}\pgfmathadd{\pgfmathresult}{-16.11809}\pgfmathresult\par
%--------------------------------------------------
-Referenz:
+\section{logarithms, compared with PGF arithmetics}
\vgl{0.1}{-2.30259}
\vgl{0.12}{-2.12026}
@@ -123,7 +121,7 @@ Referenz:
\vgl{9217}{9.12880488399366}%
-Umwandlung nach float:
+\section{Conversion to normalised floating point numbers basis 10}
\normalize{123.41251}%
\normalize{123412.51}%
\normalize{12341251.0}%
@@ -148,9 +146,12 @@ Umwandlung nach float:
\normalize{3261.01452e-06}%
\normalize{0.000326101452e-06}%
-\message{SONDERFALL 0}%
+\message{SPECIAL CASE 0}%
\normalize{0}
\normalize{-0}
+\normalize{-0.000}
+\normalize{+0.000}
+\normalize{+0}
\normalize{-1}
\normalize{1.0e1}
\tracingmacros=2\tracingcommands=2
@@ -159,7 +160,7 @@ Umwandlung nach float:
\normalize{1141}
\normalize{-53e-5}
-\section{Test fuer prettyprinter}
+\section{Test for prettyprinter}
\message{PRETTY PRINTING}
\pretty{1}
\pretty{1.0}
@@ -175,9 +176,158 @@ Umwandlung nach float:
\pretty{-0.559}
\pretty{-0.554}
+\section{testing scimathlessthan}
+\def\testsci#1#2{%
+ \sciparsesign{#1}\S\M\E
+ \sciparsesign{#2}\SS\MM\EE
+ \message{checking #1 <= #2; [\S] \M * 10^\E <= [\SS] \MM * 10^\EE}%
+ \scimathlessthan\S\M\E\and\SS\MM\EE
+ \ifscimathlessthan
+ \def\result{<}%
+ \else
+ \def\result{\ge}%
+ \fi
+ \[ \text{scimathlessthan: } \bigl( [\S]\, \M \cdot 10^{\E} \bigr)\; = #1 \result #2\; \bigl( = [\SS]\, \MM \cdot 10^{\EE} \big). \]
+}%
-\bibliographystyle{gerabbrv} %gerapali} %gerabbrv} %gerunsrt.bst} %gerabbrv}% gerplain}
-% \bibliography{literatur.bib}
-\end{document}
+\testsci{4}{5}
+\testsci{0}{2}
+\testsci{91751123}{241924}
+\testsci{-1}{-1}
+\testsci{-1231}{0}
+\testsci{10}{-5}
+\testsci{0}{0}
+\testsci{-0}{-0}
+\testsci{0}{14}
+\testsci{114812}{-123124123}
+\testsci{114812}{1241231451}
+\testsci{-141285}{29}
+\testsci{-141285}{0}
+\testsci{-141285}{-50}
+\testsci{-141285}{-12498149012}
+\section{Sci to fixed test}
+\def\testscitofixed#1{%
+ \sciparsesign{#1}\S\M\E
+%\tracingmacros=2\tracingcommands=2
+ \message{converting #1 = [\S] \M * 10^\E\ to fixed point}%
+ \scitofixed\S\M\E\result
+ \message{-> \result}%
+%\tracingmacros=0\tracingcommands=0
+ \[ \bigl( [\S]\, \M \cdot 10^{\E} \bigr)\; = #1 \mapsto \result \]
+}%
+\testscitofixed{0}
+\testscitofixed{5}
+\testscitofixed{5.520241}
+\testscitofixed{124.10241}
+\testscitofixed{-121.248}
+\testscitofixed{-12e-5}
+\testscitofixed{412e3}
+\testscitofixed{0.0001}
+\testscitofixed{0.0}
+\testscitofixed{-0.012125}
+\testscitofixed{1.2e-1}
+\testscitofixed{1.2e-2}
+\testscitofixed{1.2e4}
+\testscitofixed{1.2345e4}
+\testscitofixed{1.234567e4}
+\testscitofixed{1.51234e0}
+\testscitofixed{15}
+\testscitofixed{-20}
+\section{Testing scimathmax and scimathmin}
+\def\testscimathminmax#1#2{%
+ \sciparsesign{#1}\S\M\E
+ \sciparsesign{#2}\SS\MM\EE
+%\tracingmacros=2\tracingcommands=2
+ \message{computing min/max #1 and #2}%
+ \scimathmin\S\M\E\and\SS\MM\EE\to\SSS\MMM\EEE
+ \scitofixed\SSS\MMM\EEE\result
+ \[ \min\{#1,#2\} = \min\{ [\S]\, \M \cdot 10^{\E}, [\SS]\, \MM\cdot 10^{\EE}\} \; = [\SSS]\; \MMM\cdot10^{\EEE} = \result \]
+ %
+ \scimathmax\S\M\E\and\SS\MM\EE\to\SSS\MMM\EEE
+ \scitofixed\SSS\MMM\EEE\result
+ \[ \max\{#1,#2\} = \max\{ [\S]\, \M \cdot 10^{\E}, [\SS]\, \MM\cdot 10^{\EE}\} \; = [\SSS]\; \MMM\cdot10^{\EEE} = \result \]
+}%
+\testscimathminmax{42}{56}
+\testscimathminmax{-4122}{1256}
+\testscimathminmax{1e12}{5.235412e24}
+\testscimathminmax{-12}{-145}
+
+\section{Testing scimathshift}
+\def\testscimathshift#1#2{%
+ \sciparsesign{#1}\S\M\E
+ \message{computing mathshift #1 by #2}%
+ \let\SS=\S\let\MM=\M\let\EE=\E
+ \scimathshift\S\M\E{#2}%
+ \scitofixed\S\M\E\result
+ \[ #1 \cdot 10^{#2} = [\SS]\, \MM \cdot 10^{\EE} \cdot 10^{#2} = [\S]\, \M \cdot 10^{\E} = \result \]
+}%
+\testscimathshift{4}{1}
+\testscimathshift{4}{2}
+\testscimathshift{4}{-1}
+\testscimathshift{4}{-2}
+\testscimathshift{0}{-2}
+\testscimathshift{1.1415130}{-2}
+\testscimathshift{1.1415130}{5}
+
+\section{Testing name floating point data structure}
+\let\SS=\empty
+\let\MM=\empty
+\let\EE=\empty
+\def\testsciDS#1#2{%
+ \sciparsesign{#1}\S\M\E
+ \message{assigning #1=(\S,\M,\E) to single-name-macro ... }%
+ \scisetcomponents{#2}\S\M\E
+ \scigetcomponents{#2}\SS\MM\EE
+ \message{result: (\SS,\MM,\EE)}%
+ \edef\expandedtest{{\noexpand #2}{\S}{\M}{\E}}%
+ \message{now with raw-numbers to single-name-macro ... }%
+ \expandafter\scisetcomponents\expandedtest
+ \scigetcomponents{#2}\SSS\MMM\EEE
+ \message{result: (\SSS,\MMM,\EEE)}%
+ \scitofixed\SS\MM\EE\result
+ \scitofixed\SSS\MMM\EEE\resultX
+ \[ #1 = [\S]\, \M \cdot 10^{\E}\text{ re-extracted }\to[\SS]\, \MM \cdot 10^{\EE} = \result\; [ \text{again: }\resultX ] \]
+}%
+\testsciDS{141.241}\test
+\testsciDS{141.241}{test}
+\testsciDS{141.241}{341}
+\def\test{eins zwei drei}
+\testsciDS{141.241}\test
+
+
+\scitofixed{1}{1.0}{2}\result\result
+
+\section{Testing fixedpointround}
+\def\testfpround#1#2{%
+\tracingmacros=2\tracingcommands=2
+ \message{computing fixedpointround(#1):}%
+ \fixedpointround#1\prec#2\to\result
+ \message{fixedpointround(#1) -> \result}%
+ \[ \text{rnd }#1 \text{ to }#2 \to \result \]
+\tracingmacros=0\tracingcommands=0
+}%
+\testfpround{1.0000}{2}
+\testfpround{-1.0000}{2}
+\testfpround{+1.0000}{2}
+\testfpround{1.003}{2}
+\testfpround{-1.003}{2}
+\testfpround{1.123}{2}
+\testfpround{1.12300012}{5}
+\testfpround{9}{2}
+\testfpround{1341}{2}
+\testfpround{0.996}{2}
+\testfpround{19999.9996}{2}
+\testfpround{-19999.9996}{2}
+\testfpround{+19999.9996}{2}
+\testfpround{9999.9996}{2}
+\testfpround{0.0004982}{3}
+\testfpround{0.0004982}{4}
+\testfpround{0.0004982}{5}
+\testfpround{0.0004982}{6}
+\testfpround{0.0004982}{7}
+\testfpround{0.0004982}{8}
+\testfpround{0.0004982}{9}
+
+\end{document}