diff options
Diffstat (limited to 'Master/texmf-dist/doc/generic/pgfplots/test/pgfmathlogtest/pgfmathlogtest.tex')
-rw-r--r-- | Master/texmf-dist/doc/generic/pgfplots/test/pgfmathlogtest/pgfmathlogtest.tex | 507 |
1 files changed, 0 insertions, 507 deletions
diff --git a/Master/texmf-dist/doc/generic/pgfplots/test/pgfmathlogtest/pgfmathlogtest.tex b/Master/texmf-dist/doc/generic/pgfplots/test/pgfmathlogtest/pgfmathlogtest.tex deleted file mode 100644 index d1264433055..00000000000 --- a/Master/texmf-dist/doc/generic/pgfplots/test/pgfmathlogtest/pgfmathlogtest.tex +++ /dev/null @@ -1,507 +0,0 @@ -\documentclass[a4paper]{article} - -\usepackage[intlimits]{amsmath} -\usepackage{amssymb} -\usepackage{amsfonts} -\usepackage{ifpdf} - -\ifpdf - \usepackage{hyperref} -\else - \def\pgfsysdriver{pgfsys-dvipdfm.def} - \usepackage[dvipdfm]{hyperref} -\fi -\usepackage{pgfmathlog} - -\parindent=0pt - - -\author{Christian Feuers\"anger} -\title{Test cases for pgfmathlog.sty} - -\def\testsection#1{\message{---------- STARTING TEST SECTION '#1'}\section{#1}} -\def\testsubsection#1{\message{-------STARTING TEST SUBSECTION '#1'}\subsection{#1}} -\def\testsubsubsection#1{\message{------STARTING TEST SUBSUBSECTION '#1'}\subsubsection{#1}} - -\begin{document} -\maketitle - -\def\vgl#1#2{% - \begingroup - \message{COMPUTING LOG(#1)}% - \pgfmathlog{#1}% - \let\actual=\pgfmathresult - \def\expected{#2}% - \pgfmathsubtract\actual\expected% - \let\abserr=\pgfmathresult - \pgfmathdivide\abserr\expected - \let\relerr=\pgfmathresult - \noindent - log(#1)\hfill= - \expected;\hfill% - actual=\actual;\hfill% - abserr=\abserr;\hfill% - relerr=\relerr;\hfill% - \endgroup - \par -}% -\def\normalize#1{% - \begingroup - \message{NORMALISING #1...}% - \sciparse#1\to\M\powten\E - \sciparsenumber{#1}\S\MM\EE - \[ #1 \mapsto \M \cdot 10^{\E}\quad \bigl( = \MM\cdot 10^{\EE}\quad [S=\S]\, \bigr) \] - \endgroup -} - -\def\pretty#1{% - \message{Pretty-printing #1...}% - \[ #1 \mapsto \prettyprintnumber{#1} \] -} - - - -%-------------------------------------------------- -% \showit{2.8128} -% log(12)=\pgfmathlog{1.2}\pgfmathadd{\pgfmathresult}{2.30258}\pgfmathresult\par -% \showit{1.2} -% \showit{4.0} -% log(1200)=\pgfmathlog{1.2}\pgfmathadd{\pgfmathresult}{6.9077}\pgfmathresult\par -% log(6.241e-7)=\pgfmathlog{6.241}\pgfmathadd{\pgfmathresult}{-16.11809}\pgfmathresult\par -%-------------------------------------------------- - -\testsection{logarithms, compared with PGF arithmetics} - -\vgl{0.1}{-2.30259} -\vgl{0.12}{-2.12026} -\vgl{0.2}{-1.60944} -\vgl{0.3}{-1.20397} -\vgl{0.4}{-0.916291} -\vgl{0.5}{-0.693147} -\vgl{0.6}{-0.510826} -\vgl{0.7}{-0.356675} -\vgl{0.75}{-0.287682} -\vgl{0.8}{-0.223144} -\vgl{0.823}{-0.194799} -\vgl{0.9}{-0.105361} -\vgl{0.96}{-0.040822} -\vgl{1.2}{0.182322} -\vgl{1.5}{0.405465} -\vgl{1.6}{0.470004} -\vgl{9.0}{2.1972245773} -\vgl{9.2}{2.2192034} -\vgl{9.3}{2.23001440} -\vgl{9.7}{2.27212588} -\vgl{10.0}{2.302585092} -\vgl{100.0}{4.605170185} -\vgl{1351.0}{7.208600337} -\vgl{9752.0}{9.185227671} -\vgl{9600.0}{9.169518377} - -\vskip1cm -\vgl{0.000142}{-8.8596835} -\vgl{0.0054124}{-5.219062661} -\vgl{0.000912697124}{-6.9991064} - -\vskip1cm -\vgl{8.31160034e-02}{-2.48751801563782}% -\vgl{2.54685628e-02}{-3.67031041875206}% -\vgl{7.40715288e-03}{-4.90530914022879}% -\vgl{2.10192154e-03}{-6.16490333357987}% -\vgl{5.87352989e-04}{-7.43988457474844}% -\vgl{1.62269942e-04}{-8.72624930084187}% -\vgl{4.44248889e-05}{-10.0217106847708}% -\vgl{1.20714122e-05}{-11.3246705288704}% -\vgl{3.26101452e-06}{-12.6334722085451}% - -\vskip1cm -\vgl{5}{1.6094379124341}% -\vgl{17}{2.83321334405622}% -\vgl{39}{3.66356164612965}% -\vgl{49}{3.89182029811063}% -\vgl{129}{4.85981240436167}% -\vgl{321}{5.77144112313002}% -\vgl{769}{6.64509096950564}% -\vgl{1793}{7.49164547360513}% -\vgl{4097}{8.31801027754687}% -\vgl{9217}{9.12880488399366}% - - -\testsection{Conversion to normalised floating point numbers basis 10} -\normalize{123.41251}% -\normalize{1023.52} -\normalize{123412.51}% -\normalize{12341251.0}% -\tracingmacros=2\tracingcommands=2 -\normalize{-12341251.0}% -\tracingmacros=0\tracingcommands=0 -\normalize{1.2341251}% -\normalize{8.02410024} -\normalize{8.024100} -\normalize{0001234.3100} -\normalize{0001234.00001} -\normalize{0001000.00001} -\normalize{0001000.00001000} -\normalize{0.12341251}% -\normalize{0.0012341251}% -\normalize{0.00000012341251}% -\normalize{-0.00000012341251}% -\normalize{10} -\normalize{100} -\normalize{99999} -\normalize{999.000} - -\normalize{8.31160034e-02}% -\normalize{2.54685628e-02}% -\normalize{7.40715288e-03}% -\normalize{2.10192154e-03}% -\normalize{5.87352989e-04}% -\normalize{-1.62269942e-04}% -\normalize{4.44248889e-05}% -\normalize{1.20714122e-05}% -\normalize{3.26101452e-06}% -\normalize{3261.01452e-06}% -\normalize{0.000326101452e-06}% - -\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 -\normalize{1e1} -\tracingmacros=0\tracingcommands=0 -\normalize{1141} -\normalize{-53e-5} - -\testsection{Test for prettyprinter} -\message{PRETTY PRINTING} -{ -\twocolumn -\def\prettytest{ -\pretty{1} -\pretty{1.0} -\pretty{-1.02311} -\pretty{-11241.02311} -\pretty{-11241} -\pretty{8124.99999} -\pretty{8124.849999} -\pretty{8124.843333} -\pretty{8.82} -\pretty{8.5} -\pretty{9.} -\pretty{-0.559} -\pretty{-0.554} -\pretty{-0.00000141} -\pretty{1.234e10} -\pretty{123456781} -\pretty{1234} -\pretty{8} -\pretty{-9.995} -\pretty{-0.015} -\pretty{-0.1} -\pretty{-0.15} -\pretty{0.15} -\pretty{-0} -\pretty{9.00} -\pretty{200.01} -\pretty{200.0000} -\pretty{1.5e-7} -\pretty{0.00035} -\pretty{0.00005} -\pretty{nan} -\pretty{inf} -\pretty{-inf} -\pretty{10} -\pretty{100} -\pretty{200} -\pretty{500} -\pretty{1000} -} - -\testsubsection{STD format} -\pgfkeys{/numbers/std} -\prettytest - -{ -\testsubsection{FIXED format} -\testsubsubsection{with period} -\pgfkeys{/numbers/fixed,/numbers/use period} -\prettytest - -\testsubsubsection{with comma} -\pgfkeys{/numbers/fixed,/numbers/use comma} -\prettytest -} - -{ -\testsubsection{FIXED ZEROFILL format} -\testsubsubsection{with period} -\pgfkeys{/numbers/fixed zerofill,/numbers/use period} -\prettytest - -\testsubsubsection{with comma} -\pgfkeys{/numbers/fixed zerofill,/numbers/use comma} -\prettytest -} - -{ -\testsubsection{sci format} -\testsubsubsection{with period} -\pgfkeys{/numbers/sci,/numbers/use period} -\prettytest - -\testsubsubsection{with comma} -\pgfkeys{/numbers/sci,/numbers/use comma} -\prettytest - -%\testsubsection{may skip mantisse} -%\pgfkeys{/numbers/sci may skip mantisse=true} -%\prettytest - -}{ -\testsubsection{sci format zerofill} -\testsubsubsection{with period} -\pgfkeys{/numbers/sci zerofill,/numbers/use period} -\prettytest - -\testsubsubsection{with comma} -\pgfkeys{/numbers/sci zerofill,/numbers/use comma} -\prettytest - -\testsubsubsection{e-style} -\pgfkeys{/numbers/sci e} -\prettytest - -\testsubsubsection{subscript-style} -\pgfkeys{/numbers/sci subscript} -\prettytest - -\testsubsubsection{subscript-style + period + no zero fill} -\pgfkeys{/numbers/sci subscript,/numbers/use period,/numbers/sci} -\prettytest - -\testsubsubsection{subscript-style precision 4} -\pgfkeys{/numbers/sci subscript,/numbers/precision=4} -\prettytest -} - -\testsubsection{int trunc format} -\pgfkeys{/numbers/int trunc} -\prettytest - -\testsubsection{int detect format} -\pgfkeys{/numbers/int detect} -\prettytest -} -\onecolumn - -\testsection{testing scimathlessthan} -\def\testsci#1#2{% - \sciparsenumber{#1}\S\M\E - \sciparsenumber{#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). \] -}% - -\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} - -\testsection{Sci to fixed test} -\def\testscitofixed#1{% - \sciparsenumber{#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} - -\testsection{Testing scimathmax and scimathmin} -\def\testscimathminmax#1#2{% - \sciparsenumber{#1}\S\M\E - \sciparsenumber{#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} - -\testsection{Testing scimathshift} -\def\testscimathshift#1#2{% - \sciparsenumber{#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} - -\testsection{Testing name floating point data structure} -\let\SS=\empty -\let\MM=\empty -\let\EE=\empty -\def\testsciDS#1#2{% - \sciparsenumber{#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 - -\testsection{Testing fixedpointround} -\def\testfpround#1#2{% -\tracingmacros=2\tracingcommands=2 - \message{computing fixedpointround(#1):}% - \def\sciroundprecision{#2}% - \fixedpointround{#1}\result - \fixedpointroundzerofill{#1}\resultz - \message{fixedpointround(#1) -> \result; (\resultz)}% - \[ \text{rnd }#1 \text{ to }#2 \to \result\; (\resultz) \] -\tracingmacros=0\tracingcommands=0 -}% -\[ \text{rnd }x \text{ to PREC} \to \text{no trailing zeros }\; (\text{trailing zeros}) \] -\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.995}{2} -\testfpround{-0.995}{2} -\testfpround{-9.95}{1} -\testfpround{-0.95}{1} -\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} - -\testsection{Testing sciround} -\def\testsciround#1#2{% -\tracingmacros=2\tracingcommands=2 - \message{computing sciround(#1):}% - \sciparsenumber{#1}\S\M\E - \def\sciroundprecision{#2}% - \sciround\S\M\E\to\rS\rM\rE - % DOESN'T WORK BECAUSE PERIOD IS MISSING: -% \scitofixed\rS\rM\rE\result - \sciroundzerofill\S\M\E\to\rrS\rrM\rrE - \scitofixed\rrS\rrM\rrE\resultz - \message{#1: round([\S] \M \cdot 10^{\E}) to #2 -> [\rS] \rM * 10^{\rM}; ([\rrS] \rrM * 10^{\rrE})}% - \[ #1: - \text{rnd}([\S] \M \cdot 10^{\E}) - \text{ to } #2 - \to - [\rS] \rM \cdot 10^{\rE} %= \result - \quad - ([\rrS] \rrM \cdot 10^{\rrE} = \resultz) - \] -\tracingmacros=0\tracingcommands=0 -}% -\[ \text{rnd }x \text{ to PREC} \to \text{no trailing zeros }\; (\text{trailing zeros}) \] -\testsciround{1.0000}{2} -\testsciround{-1.0000}{2} -\testsciround{+1.0000}{2} -\testsciround{1.003}{2} -\testsciround{-1.003}{2} -\testsciround{1.123}{2} -\testsciround{1.12300012}{5} -\testsciround{9}{2} -\testsciround{1341}{2} -\testsciround{0.996}{2} -\testsciround{19999.9996}{2} -\testsciround{-19999.9996}{2} -\testsciround{+19999.9996}{2} -\testsciround{9999.9996}{2} -\testsciround{0.0004982}{3} -\testsciround{0.0004982}{4} -\testsciround{0.0004982}{5} -\testsciround{0.0004982}{6} -\testsciround{0.0004982}{7} -\testsciround{0.0004982}{8} -\testsciround{0.0004982}{9} -\end{document} |