diff options
author | Karl Berry <karl@freefriends.org> | 2022-09-17 19:55:48 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-09-17 19:55:48 +0000 |
commit | 32c43c05780d73b1e0095d809053db3b71121e54 (patch) | |
tree | 375bca28d0ec309a3557f39f2a3537d6cf820227 /Master | |
parent | 92adf95ed165100e9db9c7b9bd00b0cb6fb71685 (diff) |
calculator (17sep22)
git-svn-id: svn://tug.org/texlive/trunk@64424 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
68 files changed, 159 insertions, 525 deletions
diff --git a/Master/texmf-dist/doc/latex/calculator/README b/Master/texmf-dist/doc/latex/calculator/README.md index 5b079743486..04c5147e30b 100644 --- a/Master/texmf-dist/doc/latex/calculator/README +++ b/Master/texmf-dist/doc/latex/calculator/README.md @@ -1,7 +1,6 @@ - The calculator and calculus packages: Use \LaTeX as a scientific calculator. -Robert Fuster, 2012, 2014 +Robert Fuster, 2012, 2014, 2022 1. Licence @@ -11,6 +10,10 @@ This material is subject to the LaTeX Project Public License. See http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html for the details of that license. +2. Changes in version 2.1 +------------------------- +- Some bugs fixed + 2. Changes in version 2.0 ------------------------- - Inverse trigonometric and inverse hyperbolic functions are added @@ -136,5 +139,5 @@ You can store or discard this files. Robert Fuster rfuster@mat.upv.es -Universitat Polit\`ecnica de Val\`encia, 2012/05/19, 2014/02/23 ----------------------------------------------------------------
\ No newline at end of file +Universitat Polit\`ecnica de Val\`encia, 2012/05/19, 2014/02/23, 2022/09/15 +--------------------------------------------------------------- diff --git a/Master/texmf-dist/doc/latex/calculator/calculator.pdf b/Master/texmf-dist/doc/latex/calculator/calculator.pdf Binary files differindex 7da66cec999..4ef145baa46 100644 --- a/Master/texmf-dist/doc/latex/calculator/calculator.pdf +++ b/Master/texmf-dist/doc/latex/calculator/calculator.pdf diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator1.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator1.tex deleted file mode 100644 index 384de7ddb83..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator1.tex +++ /dev/null @@ -1,16 +0,0 @@ -% \tempA=2,5^2 - \SQUARE{2.5}{\tempA} -% \tempB=sqrt(12) - \SQUAREROOT{12}{\tempB} -% \tempC=exp(3,4) - \EXP{3.4}{\tempC} -% \divisio=\tempA/tempB - \DIVIDE{\tempA}{\tempB}{\divisio} -% \sol=\divisio+\tempC - \ADD{\divisio}{\tempC}{\sol} -\begin{align*} -\frac{2.5^2}{\sqrt{12}}+\mathrm{e}^{3.4} - &= \frac{\tempA}{\tempB}+\tempC \\ - &= \divisio+\tempC \\ - &=\sol -\end{align*} diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator10.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator10.tex deleted file mode 100644 index 6864af9ad58..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator10.tex +++ /dev/null @@ -1,2 +0,0 @@ -\SQUARE{-1.256}{\sol} -$(-1.256)^2=\sol$ diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator11.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator11.tex deleted file mode 100644 index 2092630e261..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator11.tex +++ /dev/null @@ -1,2 +0,0 @@ -\CUBE{-1.256}{\sol} -$(-1.256)^3=\sol$ diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator12.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator12.tex deleted file mode 100644 index b66337da47e..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator12.tex +++ /dev/null @@ -1,12 +0,0 @@ -\POWER{-1.256}{-5}{\sola} -\POWER{-1.256}{5}{\solb} -\POWER{-1.256}{0}{\solc} -\[ -\begin{aligned} -(-1.256)^{-5}&=\sola -\\ -(-1.256)^{5}&=\solb -\\ -(-1.256)^{0}&=\solc -\end{aligned} -\] diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator13.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator13.tex deleted file mode 100644 index cc98a935aec..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator13.tex +++ /dev/null @@ -1,2 +0,0 @@ -\ABSVALUE{-1.256}{\sol} -$\left\vert-1.256\right\vert=\sol$ diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator14.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator14.tex deleted file mode 100644 index 45ebda7c91f..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator14.tex +++ /dev/null @@ -1,4 +0,0 @@ -\INTEGERPART{1.256}{\sola} -\INTEGERPART{-1.256}{\solb} -The integer part of $1.256$ is $\sola$, -but the integer part of $-1.256$ is $\solb$. diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator15.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator15.tex deleted file mode 100644 index 56fad96daba..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator15.tex +++ /dev/null @@ -1,2 +0,0 @@ -\FLOOR{1.256}{\sol} -The integer part of $1.256$ is $\sol$. diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator16.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator16.tex deleted file mode 100644 index 01050f4b105..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator16.tex +++ /dev/null @@ -1,5 +0,0 @@ -\FRACTIONALPART{1.256}{\sol} -\sol - -\FRACTIONALPART{-1.256}{\sol} -\sol diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator17.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator17.tex deleted file mode 100644 index 5b003431148..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator17.tex +++ /dev/null @@ -1,8 +0,0 @@ -\TRUNCATE[0]{1.25688}{\sol} -\sol - -\TRUNCATE[2]{1.25688}{\sol} -\sol - -\TRUNCATE[4]{1.25688}{\sol} -\sol diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator18.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator18.tex deleted file mode 100644 index d6d05c21da2..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator18.tex +++ /dev/null @@ -1,8 +0,0 @@ -\ROUND[0]{1.25688}{\sol} -\sol - -\ROUND[2]{1.25688}{\sol} -\sol - -\ROUND[4]{1.25688}{\sol} -\sol diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator19.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator19.tex deleted file mode 100644 index c3edaec1594..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator19.tex +++ /dev/null @@ -1,14 +0,0 @@ -\INTEGERDIVISION{435}{27}{\sola}{\solb} -$435=27\times\sola+\solb$ - -\INTEGERDIVISION{27}{435}{\sola}{\solb} -$27=435\times\sola+\solb$ - -\INTEGERDIVISION{-435}{27}{\sola}{\solb} -$-435=27\times(\sola)+\solb$ - -\INTEGERDIVISION{435}{-27}{\sola}{\solb} -$435=-27\times(\sola)+\solb$ - -\INTEGERDIVISION{-435}{-27}{\sola}{\solb} -$-435=-27\times\sola+\solb$ diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator2.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator2.tex deleted file mode 100644 index 6136ee24cdf..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator2.tex +++ /dev/null @@ -1,14 +0,0 @@ -\SQUARE{5}\sol -The \texttt{\textbackslash sol} -command contains the square of $5$: -\[5^2=\sol\] -\begin{center} -\SQUAREROOT{5}\sol -Now, the \texttt{\textbackslash sol} -command is the square root of $5$: -\[\sqrt{5}=\sol\] -\end{center} -On having gone out of the \texttt{center} -environment, -the command recovers its previous value: -\sol diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator20.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator20.tex deleted file mode 100644 index 015b06455a3..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator20.tex +++ /dev/null @@ -1,8 +0,0 @@ -\INTEGERQUOTIENT{435}{27}{\sol} -\sol - -\INTEGERQUOTIENT{27}{435}{\sol} -\sol - -\INTEGERQUOTIENT{-43.5}{2.7}{\sol} -\sol diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator21.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator21.tex deleted file mode 100644 index cbbc842b31c..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator21.tex +++ /dev/null @@ -1,8 +0,0 @@ -\MODULO{435}{27}{\sol} -\[ -435 \equiv \sol \pmod{27} -\] -\MODULO{-435}{27}{\sol} -\[ --435 \equiv \sol \pmod{27} -\] diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator22.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator22.tex deleted file mode 100644 index b2175182b9d..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator22.tex +++ /dev/null @@ -1,2 +0,0 @@ -\GCD{435}{27}{\sol} -$\gcd(435,27)=\sol$ diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator23.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator23.tex deleted file mode 100644 index 685027f4f98..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator23.tex +++ /dev/null @@ -1,3 +0,0 @@ -\newcommand{\lcm}{\operatorname{lcm}} -\LCM{435}{27}{\sol} -$\lcm(435,27)=\sol$ diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator24.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator24.tex deleted file mode 100644 index ed5a5bb26f1..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator24.tex +++ /dev/null @@ -1,2 +0,0 @@ -\FRACTIONSIMPLIFY{435}{27}{\sola}{\solb} -$435/27=\sola/\solb$ diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator25.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator25.tex deleted file mode 100644 index 6df41c19e8a..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator25.tex +++ /dev/null @@ -1,2 +0,0 @@ -\SQUAREROOT{1.44}{\sol} -$\sqrt{1.44}=\sol$ diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator26.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator26.tex deleted file mode 100644 index 41fd8b4ed82..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator26.tex +++ /dev/null @@ -1,2 +0,0 @@ -\EXP{0.5}{\sol} -$\exp(0.5)=\sol$ diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator27.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator27.tex deleted file mode 100644 index 0a8af280fa0..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator27.tex +++ /dev/null @@ -1,6 +0,0 @@ -\EXP[10]{1.3}{\sol} -$10^{1.3}=\sol$ - -\EXP[2]{0.33333}{\sol} -$2^{1/3}=\sol$ - diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator28.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator28.tex deleted file mode 100644 index 82bf398f848..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator28.tex +++ /dev/null @@ -1,2 +0,0 @@ -\LOG{0.5}{\sol} -$\log 0.5=\sol$ diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator29.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator29.tex deleted file mode 100644 index ed2bf1e00c5..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator29.tex +++ /dev/null @@ -1,2 +0,0 @@ -\LOG[10]{0.5}{\sol} -$\log_{10} 0.5=\sol$ diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator3.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator3.tex deleted file mode 100644 index 11f7296ffe2..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator3.tex +++ /dev/null @@ -1,2 +0,0 @@ -\COPY{-1.256}{\sol} -\sol diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator30.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator30.tex deleted file mode 100644 index e41832e74ce..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator30.tex +++ /dev/null @@ -1,11 +0,0 @@ -\SIN{\numberTHIRDPI}{\sol} -$\sin \pi/3=\sol$ - -\COS{\numberTHIRDPI}{\sol} -$\cos \pi/3=\sol$ - -\TAN{\numberTHIRDPI}{\sol} -$\tan \pi/3=\sol$ - -\COT{\numberTHIRDPI}{\sol} -$\cot \pi/3=\sol$ diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator31.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator31.tex deleted file mode 100644 index cc5a388a759..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator31.tex +++ /dev/null @@ -1,11 +0,0 @@ -\DEGREESSIN{60}{\sol} -$\sin 60^{\textrm o}=\sol$ - -\DEGREESCOS{60}{\sol} -$\cos 60^{\textrm o}=\sol$ - -\DEGREESTAN{60}{\sol} -$\tan 60^{\textrm o}=\sol$ - -\DEGREESCOT{60}{\sol} -$\cot 60^{\textrm o}=\sol$ diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator32.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator32.tex deleted file mode 100644 index 9956ce25951..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator32.tex +++ /dev/null @@ -1,11 +0,0 @@ -\DEGREESCOS[400]{50}{\sol} -\sol - -\DEGREESCOS{45}{\sol} -\sol - -\COS{\numberQUARTERPI}{\sol} -\sol - -\DEGREESCOS[8]{1}{\sol} -\sol diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator33.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator33.tex deleted file mode 100644 index dc73dd1a40d..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator33.tex +++ /dev/null @@ -1,2 +0,0 @@ -\DEGtoRAD{60}{\sol} -\sol diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator34.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator34.tex deleted file mode 100644 index 3125997f51a..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator34.tex +++ /dev/null @@ -1,7 +0,0 @@ -\MULTIPLY{\numberTWOPI}{10}{\TWENTYPI} -\ADD{\numberPI}{\TWENTYPI}{\TWENTYONEPI} -\REDUCERADIANSANGLE{\TWENTYONEPI}{\sol} -\sol - -\REDUCEDEGREESANGLE{3690}{\sol} -\sol diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator35.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator35.tex deleted file mode 100644 index cdd27aa2427..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator35.tex +++ /dev/null @@ -1,11 +0,0 @@ -\SINH{1.256}{\sol} -\sol - -\COSH{1.256}{\sol} -\sol - -\TANH{1.256}{\sol} -\sol - -\COTH{1.256}{\sol} -\sol diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator36.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator36.tex deleted file mode 100644 index 0616dd824b3..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator36.tex +++ /dev/null @@ -1,11 +0,0 @@ -\ARCSIN{0.5}{\sol} -\sol - -\ARCCOS{0.5}{\sol} -\sol - -\ARCTAN{\numberSQRTTHREE}{\sol} -\sol - -\ARCCOT{-1}{\sol} -\sol diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator37.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator37.tex deleted file mode 100644 index 8e969be57ef..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator37.tex +++ /dev/null @@ -1,11 +0,0 @@ -\ARSINH{1}{\sol} -\sol - -\ARCOSH{1}{\sol} -\sol - -\ARTANH{0.5}{\sol} -\sol - -\ARCOTH{2}{\sol} -\sol diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator38.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator38.tex deleted file mode 100644 index 9f94dd02ada..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator38.tex +++ /dev/null @@ -1,2 +0,0 @@ -\LENGTHDIVIDE{1in}{1cm}{\sol} -One inch equals $\sol$ centimeters. diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator39.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator39.tex deleted file mode 100644 index 5673f857f2e..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator39.tex +++ /dev/null @@ -1,6 +0,0 @@ -\newlength{\mylength} -\LENGTHADD{1in}{1cm}{\mylength} -$1in+1cm=\the\mylength$. - -\LENGTHSUBTRACT{1in}{1cm}{\mylength} -$1in-1cm=\the\mylength$. diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator4.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator4.tex deleted file mode 100644 index 123ab06a45a..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator4.tex +++ /dev/null @@ -1,2 +0,0 @@ -\MAX{1.256}{3.214}{\sol} -\[\max(1.256,3.214)=\sol\] diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator40.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator40.tex deleted file mode 100644 index 848ea112443..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator40.tex +++ /dev/null @@ -1,5 +0,0 @@ -\VECTORCOPY(1,-1)(\sola,\solb) -$(\sola,\solb)$ - -\VECTORCOPY(1,-1,2)(\sola,\solb,\solc) -$(\sola,\solb,\solc)$ diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator41.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator41.tex deleted file mode 100644 index e7d761a1306..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator41.tex +++ /dev/null @@ -1,5 +0,0 @@ -\VECTORADD(1,-1,2)(3,5,-1)(\sola,\solb,\solc) -$(1,-1,2)+(3,5,-1)=(\sola,\solb,\solc)$ - -\VECTORSUB(1,-1,2)(3,5,-1)(\sola,\solb,\solc) -$(1,-1,2)-(3,5,-1)=(\sola,\solb,\solc)$ diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator42.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator42.tex deleted file mode 100644 index 9af0c8329a1..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator42.tex +++ /dev/null @@ -1,6 +0,0 @@ -\SCALARVECTORPRODUCT{2}(3,5)(\sola,\solb) -$2(3,5)=(\sola,\solb)$ - -\SCALARVECTORPRODUCT{2}(3,5,-1)(% - \sola,\solb,\solc) -$2(3,5,-1)=(\sola,\solb,\solc)$ diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator43.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator43.tex deleted file mode 100644 index dc09a660bf7..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator43.tex +++ /dev/null @@ -1,11 +0,0 @@ -\SCALARPRODUCT(1,-1)(3,5){\sol} -$(1,-1)\cdot(3,5)=\sol$ - -\DOTPRODUCT(1,-1,2)(3,5,-1){\sol} -$(1,-1,2)\cdot(3,5,-1)=\sol$ - -\VECTORNORM(3,4)\sol -$\left\|(3,4)\right\|=\sol$ - -\VECTORNORM(1,2,-2)\sol -$\left\|(1,2,-2)\right\|=\sol$ diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator44.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator44.tex deleted file mode 100644 index e8414d41148..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator44.tex +++ /dev/null @@ -1,8 +0,0 @@ -\CROSSPRODUCT(1,-1,2)(3,5,-1)% - (\sola,\solb,\solc) -$(1,-1,2)\times(3,5,-1)=(\sola,\solb,\solc)$ - -\VECTORPRODUCT(1,-1,2)(-3,3,-6)% - (\sola,\solb,\solc) -$(1,-1,2)\times(-3,3,-6)=(\sola,\solb,\solc)$ - diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator45.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator45.tex deleted file mode 100644 index 045880987a1..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator45.tex +++ /dev/null @@ -1,5 +0,0 @@ -\UNITVECTOR(3,4)(\sola,\solb) -$(\sola,\solb)$ - -\UNITVECTOR(1,2,-2)(\sola,\solb,\solc) -$(\sola,\solb,\solc)$ diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator46.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator46.tex deleted file mode 100644 index c4df209d4ad..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator46.tex +++ /dev/null @@ -1,5 +0,0 @@ -\VECTORABSVALUE(3,-4)(\sola,\solb) -$(\sola,\solb)$ - -\VECTORABSVALUE(3,-4,-1)(\sola,\solb,\solc) -$(\sola,\solb,\solc)$ diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator47.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator47.tex deleted file mode 100644 index 73498a1f1a1..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator47.tex +++ /dev/null @@ -1,9 +0,0 @@ -\TWOVECTORSANGLE(1,1)(0,1){\sol} -$\sol$ radians -\RADtoDEG{\sol}{\degsol} -(or $\degsol$ degrees) - -\TWOVECTORSANGLE(1,0,0)(0,1,0){\sol} -$\sol$ -\RADtoDEG{\sol}{\degsol} -(or $\degsol$ degrees) diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator48.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator48.tex deleted file mode 100644 index a0dd9f85cc5..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator48.tex +++ /dev/null @@ -1,11 +0,0 @@ -\MATRIXCOPY(1, -1, 2; - 3, 0, 5; - -1, 1, 4)% - (\sola,\solb,\solc; - \sold,\sole,\solf; - \solg,\solh,\soli) -$\begin{bmatrix} - \sola & \solb & \solc \\ - \sold & \sole & \solf \\ - \solg & \solh & \soli - \end{bmatrix}$ diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator49.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator49.tex deleted file mode 100644 index 5ee6b5cfa5d..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator49.tex +++ /dev/null @@ -1,7 +0,0 @@ -\TRANSPOSEMATRIX(1,-1;3,0)% - (\sola,\solb;\solc,\sold) -$\begin{bmatrix} - 1 & -1 \\ 3 & 0 - \end{bmatrix}^T=\begin{bmatrix} - \sola & \solb \\ \solc & \sold - \end{bmatrix}$ diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator5.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator5.tex deleted file mode 100644 index 0f410c70277..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator5.tex +++ /dev/null @@ -1,2 +0,0 @@ -\MIN{1.256}{3.214}{\sol} -\sol diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator50.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator50.tex deleted file mode 100644 index c1ed8fc0ac3..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator50.tex +++ /dev/null @@ -1,21 +0,0 @@ -\MATRIXADD(1,-1;3,0)(3,5;-3,2)% - (\sola,\solb;\solc,\sold) -$\begin{bmatrix} - 1 & -1 \\ 3 & 0 - \end{bmatrix}+ -\begin{bmatrix} - 3 & 5 \\ -3 & 2 - \end{bmatrix}=\begin{bmatrix} - \sola & \solb \\ \solc & \sold - \end{bmatrix}$ - -\MATRIXSUB(1,-1;3,0)(3,5;-3,2)% - (\sola,\solb;\solc,\sold) -$\begin{bmatrix} - 1 & -1 \\ 3 & 0 - \end{bmatrix}- -\begin{bmatrix} - 3 & 5 \\ -3 & 2 - \end{bmatrix}=\begin{bmatrix} - \sola & \solb \\ \solc & \sold - \end{bmatrix}$ diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator51.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator51.tex deleted file mode 100644 index c5cf74d4753..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator51.tex +++ /dev/null @@ -1,14 +0,0 @@ -\SCALARMATRIXPRODUCT{3}(1,-1,2; - 3, 0,5; - -1, 1,4)% - (\sola,\solb,\solc; - \sold,\sole,\solf; - \solg,\solh,\soli) -$3\begin{bmatrix} - 1 & -1 & 2 \\ 3 & 0 & 5 \\ -1 & 1 & 4 - \end{bmatrix} - =\begin{bmatrix} - \sola & \solb & \solc \\ - \sold & \sole & \solf \\ - \solg & \solh & \soli - \end{bmatrix}$ diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator52.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator52.tex deleted file mode 100644 index 6abe4e7a0b6..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator52.tex +++ /dev/null @@ -1,11 +0,0 @@ -\MATRIXVECTORPRODUCT(1,-1; - 0, 2)(3,5)(\sola,\solb) -$\begin{bmatrix} - 1 & -1 \\ 0 & 2 - \end{bmatrix} - \begin{bmatrix} - 3 \\ 5 - \end{bmatrix} - =\begin{bmatrix} - \sola \\ \solb - \end{bmatrix}$ diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator53.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator53.tex deleted file mode 100644 index c8e2cbeaba1..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator53.tex +++ /dev/null @@ -1,18 +0,0 @@ -\MATRIXPRODUCT(1,-1,2;3,0,5;-1,1,4)% - (3,5,-1;-3,2,-5;1,-2,3)% - (\sola,\solb,\solc; - \sold,\sole,\solf; - \solg,\solh,\soli) -\begin{multline*} -\begin{bmatrix} - 1 & -1 & 2 \\ 3 & 0 & 5 \\ -1 & 1 & 4 - \end{bmatrix} -\begin{bmatrix} - 3 & 5 & -1 \\ -3 & 2 & -5 \\ 1 & -2 & 3 - \end{bmatrix}\\ -=\begin{bmatrix} - \sola & \solb & \solc \\ - \sold & \sole & \solf \\ - \solg & \solh & \soli -\end{bmatrix} -\end{multline*} diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator54.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator54.tex deleted file mode 100644 index 16c0b0a8c8b..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator54.tex +++ /dev/null @@ -1,5 +0,0 @@ -\DETERMINANT(1,-1,2;3,0,5;-1,1,4){\sol} -\SpecialUsageIndex{\DETERMINANT}% -$\begin{vmatrix} - 1 & -1 & 2 \\ 3 & 0 & 5 \\ -1 & 1 & 4 - \end{vmatrix}=\sol$ diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator55.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator55.tex deleted file mode 100644 index 7ad03915b39..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator55.tex +++ /dev/null @@ -1,8 +0,0 @@ -\INVERSEMATRIX(1,-1;3,5)(% - \sola,\solb;\solc,\sold) -$\begin{bmatrix} - 1 & -1 \\ 3 & 5 - \end{bmatrix}^{-1}= - \begin{bmatrix} - \sola & \solb \\ \solc & \sold - \end{bmatrix}$ diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator56.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator56.tex deleted file mode 100644 index bd69eaf743b..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator56.tex +++ /dev/null @@ -1,9 +0,0 @@ -\MATRIXABSVALUE(1,-1,2;3,0,5;-1,1,4)% - (\sola,\solb,\solc; - \sold,\sole,\solf; - \solg,\solh,\soli) -$\begin{bmatrix} - \sola & \solb & \solc \\ - \sold & \sole & \solf \\ - \solg & \solh & \soli - \end{bmatrix}$ diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator57.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator57.tex deleted file mode 100644 index 1ad53821cf8..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator57.tex +++ /dev/null @@ -1,15 +0,0 @@ -\SOLVELINEARSYSTEM(1,-1,2;3,0,5;-1,1,4)% - (-4,4,-2)% - (\sola,\solb,\solc) -Solving the linear system -\[ -\begin{bmatrix} - 1 & -1 & 2 \\ 3 & 0 & 5 \\ -1 & 1 & 4 - \end{bmatrix}\mathsf{X}=\begin{bmatrix} - -4\\4\\-2 - \end{bmatrix} -\] -we obtain -$\mathsf{X}=\begin{bmatrix} - \sola \\ \solb\\ \solc - \end{bmatrix}$ diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator58.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator58.tex deleted file mode 100644 index 2696c2df99c..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator58.tex +++ /dev/null @@ -1,5 +0,0 @@ -\SQUAREfunction{3}{\sol}{\Dsol} -If $f(t)=t^2$, then -\[ - f(3)=\sol \mbox{ and } f'(3)=\Dsol -\] diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator59.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator59.tex deleted file mode 100644 index 4a99aefa2ad..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator59.tex +++ /dev/null @@ -1,15 +0,0 @@ -$\begin{array}{cll} -x & \log x & \log' x \\ -\LOGfunction{1}{\logx}{\Dlogx} -1 &\logx & \Dlogx\\ -\LOGfunction{2}{\logx}{\Dlogx} -2 &\logx & \Dlogx\\ -\LOGfunction{3}{\logx}{\Dlogx} -3 &\logx & \Dlogx\\ -\LOGfunction{4}{\logx}{\Dlogx} -4 &\logx & \Dlogx\\ -\LOGfunction{5}{\logx}{\Dlogx} -5 &\logx & \Dlogx\\ -\LOGfunction{6}{\logx}{\Dlogx} -6 &\logx & \Dlogx -\end{array}$ diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator6.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator6.tex deleted file mode 100644 index 663c9a1bff9..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator6.tex +++ /dev/null @@ -1,2 +0,0 @@ -\ADD{1.256}{3.214}{\sol} -$1.256+3.214=\sol$ diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator60.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator60.tex deleted file mode 100644 index 4a0ab779c75..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator60.tex +++ /dev/null @@ -1,30 +0,0 @@ -% exp(-t) - \SCALEVARIABLEfunction - {-1}{\EXPfunction} - {\NEGEXPfunction} - -% exp(-t)cos(t) - \PRODUCTfunction - {\NEGEXPfunction} - {\COSfunction} - {\NEGEXPCOSfunction} - -% 3t^2-2exp(-t)cos(t) - \LINEARCOMBINATIONfunction - {3}{\SQUAREfunction} - {-2}{\NEGEXPCOSfunction} - {\myfunction} - -\myfunction{5}{\sol}{\Dsol} - -If -\[ - f(t)=3t^2-2\mathrm{e}^{-t}\cos t -\] -then -\[ -\begin{gathered} - f(5)=\sol\\ - f'(5)=\Dsol -\end{gathered} -\] diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator61.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator61.tex deleted file mode 100644 index f5c10e29574..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator61.tex +++ /dev/null @@ -1,4 +0,0 @@ -% \mypoly=1-x^2+x^3 - \newcpoly{\mypoly}{1}{0}{-1}{1} - \mypoly{2}{\sol}{\Dsol} -$p'(2)=\Dsol$ diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator62.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator62.tex deleted file mode 100644 index 9caca3c8c7b..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator62.tex +++ /dev/null @@ -1,9 +0,0 @@ -For the $f(t)=(t^2,t^3)$ function we have -\VECTORfunction - {\SQUAREfunction}{\CUBEfunction}{\F} - -\F{4}{\solx}{\Dsolx}{\soly}{\Dsoly} - -\[ -f(4)=(\solx,\soly), f'(4)=(\Dsolx,\Dsoly) -\] diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator7.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator7.tex deleted file mode 100644 index 6f0d9c2fea7..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator7.tex +++ /dev/null @@ -1,2 +0,0 @@ -\SUBTRACT{1.256}{3.214}{\sol} -$1.256-3.214=\sol$ diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator8.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator8.tex deleted file mode 100644 index de60a332745..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator8.tex +++ /dev/null @@ -1,2 +0,0 @@ -\MULTIPLY{1.256}{3.214}{\sol} -$1.256\times3.214=\sol$ diff --git a/Master/texmf-dist/doc/latex/calculator/examples/calculator9.tex b/Master/texmf-dist/doc/latex/calculator/examples/calculator9.tex deleted file mode 100644 index f3c94758d93..00000000000 --- a/Master/texmf-dist/doc/latex/calculator/examples/calculator9.tex +++ /dev/null @@ -1,2 +0,0 @@ -\DIVIDE{1.256}{3.214}{\sol} -$1.256/3.214=\sol$ diff --git a/Master/texmf-dist/source/latex/calculator/calculator.dtx b/Master/texmf-dist/source/latex/calculator/calculator.dtx index 41d95f24a0e..64f6fe0b6aa 100644 --- a/Master/texmf-dist/source/latex/calculator/calculator.dtx +++ b/Master/texmf-dist/source/latex/calculator/calculator.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright (C) 2012, 2014 by Robert Fuster <rfuster@mat.upv.es> +% Copyright (C) 2012, 2014, 2022 by Robert Fuster <rfuster@mat.upv.es> % % This work may be distributed and/or modified under the conditions of % the LaTeX Project Public License, either version 1.3 of this license @@ -27,15 +27,16 @@ %<*driver> \documentclass{ltxdoc} \ProvidesFile{calculator.dtx} - [2014/02/20 v.2.0 documented calculator package] + [2022/09/15 v.2.1 documented calculator package] \usepackage{calculus} \usepackage{amsmath} \usepackage[lmargin=1.75in,rmargin=1in]{geometry} \usepackage{fancyvrb} -\def\fileversion{2.0} -\def\filedate{2014/02/20} +\usepackage[colorlinks]{hyperref} +\def\fileversion{2.1} +\def\filedate{2022/09/15} \GetFileInfo{calculator.dtx} @@ -58,6 +59,7 @@ \newcommand{\Marg}[1]{\textnormal{\marg{#1}}} \newcommand{\newinversion}[1]{\textnormal{\textit{(new in version~#1)}}} +\newcommand{\renewinversion}[2][]{\textnormal{\footnote{code modified in version~#2\ifx"#1"\else\space (#1)\fi.}}} \newcommand{\arccot}{\operatorname{arccot}} \newcommand{\arsinh}{\operatorname{arsinh}} @@ -97,11 +99,12 @@ % % \fi % -% \CheckSum{3753} +% \CheckSum{3913} % \changes{v1.0}{2012/04/25}{First public version} % \changes{v1.0a}{2012/06/10}{calculator.dtx modified to make it autoinstallable. % calculus.dtx embedded in calculus.dtx} % \changes{v2.0}{2014/02/20}{new calculator.dtx and calculator.ins files} +% \changes{v2.1}{2022/09/15}{Some bugs fixed} %% \CharacterTable %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z %% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z @@ -154,6 +157,10 @@ % (so that we can work with all the classic elementary functions), % and also can do some additional calculation with vectors % (such as the cross product and the angle between two vectors). + +% Version 2.1 fixes some bugs and calculation problems.\footnote{Thanks to +% Schmitz Manuel, Thorsten Wolterin, Jim Cline, +% Schremmer Alain and July Tikhonov.} % \end{abstract} % % \tableofcontents @@ -447,7 +454,8 @@ % \end{exemple} % \item[\cs{FRACTIONALPART}\marg{num}\marg{\cs{cmd}}]% % \SpecialUsageIndex{\FRACTIONALPART}% -% Fractional part of \textttit{num}. +% Fractional part of \textttit{num}.\renewinversion[thanks to July Tikhonov +% who reported a bug and suggested the solution]{2.1} % \begin{exemple} % \FRACTIONALPART{1.256}{\sol} % \sol @@ -463,7 +471,9 @@ % truncates the number \textttit{num} to \textttit{n} decimal places. % \item[\cs{ROUND}{[\textttit{n}]}\marg{num}\marg{\cs{cmd}}]% % \SpecialUsageIndex{\ROUND}% -% rounds the number \textttit{num} to \textttit{n} decimal places. +% rounds the number \textttit{num} to \textttit{n} decimal places.% +% \renewinversion[thanks to Jim Cline and Schremmer Alain +% who reported a bug]{2.1} % % The optional argument \textttit{n} may be \texttt{0}, \texttt{1}, % \texttt{2}, \texttt{3} or \texttt{4} (the default is \texttt{2}).\footnote{% @@ -1872,7 +1882,7 @@ % \begin{macrocode} %<*calculator> \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{calculator}[2014/02/20 v.2.0] +\ProvidesPackage{calculator}[2022/09/15 v.2.1] % \end{macrocode} % \subsection{Internal lengths and special numbers} % \cs{cctr@lengtha} and \cs{cctr@lengthb} @@ -1902,6 +1912,18 @@ % \end{macro} % \subsection{Warning messages} % \begin{macrocode} +\def\cctr@Warntruncate#1#2{% + \PackageWarning{calculator}% + {The optional argument in truncate \MessageBreak + must be less than 5 \MessageBreak + I copy #1 to #2 \MessageBreak without truncating}} + +\def\cctr@Warnround#1#2{% + \PackageWarning{calculator}% + {The optional argument in round \MessageBreak + must be less than 5 \MessageBreak + I copy #1 to #2 \MessageBreak without rounding}} + \def\cctr@Warndivzero#1#2{% \PackageWarning{calculator}% {Division by 0.\MessageBreak @@ -2347,7 +2369,7 @@ % returns the integer part of \textit{\#2}. % \begin{macrocode} \def\@@INTEGERPART#1.#2.#3)#4{\ifnum #11=1 \COPY{0}{#4} - \else \COPY{#1}{#4}\fi} + \else \ADD{0}{#1}{#4}\fi} \def\@INTEGERPART#1#2{\expandafter\@@INTEGERPART#1..){#2}} \def\INTEGERPART#1#2{\begingroup \ifdim #1\p@<\z@ @@ -2372,9 +2394,10 @@ % \cs{FRACTIONALPART}\marg{\#1}\marg{\#2} % returns the fractional part of % \textit{\#2}. +% \changes{v2.1}{2022/09/15}{Bug fixed} % \begin{macrocode} -\def\@@FRACTIONALPART#1.#2.#3)#4{\ifnum #2=11 \COPY{0}{#4} - \else \COPY{0.#2}{#4}\fi} +\def\@@FRACTIONALPART#1.#2.#3)#4{\ifnum #21=1 \COPY{0}{#4} + \else \ADD{0}{0.#2}{#4}\fi} \def\@FRACTIONALPART#1#2{\expandafter\@@FRACTIONALPART#1..){#2}} \def\FRACTIONALPART#1#2{\begingroup \ifdim #1\p@<\z@ @@ -2382,24 +2405,29 @@ \SUBTRACT{#1}{\cctr@tempA}{#2} \else \@FRACTIONALPART{#1}{#2} - \fi\@OUTPUTSOL{#2}} + \fi\@OUTPUTSOL{#2}} + % \end{macrocode} % \end{macro} % \begin{macro}{\TRUNCATE} % \cs{TRUNCATE}\oarg{\#1}\marg{\#2}\marg{\#3} % truncates \textit{\#2} to \textit{\#1} (0, 1, 2 (default), 3 or 4) digits. +% \changes{v2.1}{2022/09/15}{Bug fixed} % \begin{macrocode} \def\TRUNCATE{\@ifnextchar[\@@TRUNCATE\@TRUNCATE} \def\@TRUNCATE#1#2{\@@TRUNCATE[2]{#1}{#2}} \def\@@TRUNCATE[#1]#2#3{% - \begingroup + \begingroup + \ifdim #1\p@ > 4\p@ \cctr@Warntruncate{#2}{\noexpand#3} \COPY{#2}{#3} + \else \INTEGERPART{#2}{\cctr@tempa} - \ifdim \cctr@tempa\p@ = #2\p@ - \expandafter\@@@TRUNCATE#2.00000)[#1]{#3} + \ifdim \cctr@tempa\p@ = #2\p@ + \expandafter\@@@TRUNCATE\cctr@tempa.00000.)[#1]{#3} \else \expandafter\@@@TRUNCATE#200000.)[#1]{#3} - \fi - \@OUTPUTSOL{#3}} + \fi\fi + \@OUTPUTSOL{#3}} + \def\@@@TRUNCATE#1.#2#3#4#5#6.#7)[#8]#9{% \ifcase #8 \COPY{#1}{#9} @@ -2413,27 +2441,48 @@ % \begin{macro}{\ROUND} % \cs{ROUND}\oarg{\#1}\marg{\#2}\marg{\#3} % rounds \textit{\#2} to \textit{\#1} (0, 1, 2 (default), 3 or 4) digits. +% \changes{v2.1}{2022/09/15}{Bug fixed} % \begin{macrocode} \def\ROUND{\@ifnextchar[\@@ROUND\@ROUND} \def\@ROUND#1#2{\@@ROUND[2]{#1}{#2}} \def\@@ROUND[#1]#2#3{% - \begingroup - \ifdim#2\p@<\z@ - \MULTIPLY{-1}{#2}{\cctr@temp} - \@@ROUND[#1]{\cctr@temp}{#3}\COPY{-#3}{#3} - \else - \@@TRUNCATE[#1]{#2}{\cctr@tempe} - \SUBTRACT{#2}{\cctr@tempe}{\cctr@tempc} - \POWER{10}{#1}{\cctr@tempb} - \MULTIPLY{\cctr@tempb}{\cctr@tempc}{\cctr@tempc} - \ifdim\cctr@tempc\p@<0.5\p@ - \else - \DIVIDE{1}{\cctr@tempb}{\cctr@tempb} - \ADD{\cctr@tempe}{\cctr@tempb}{\cctr@tempe} - \fi - \@@TRUNCATE[#1]{\cctr@tempe}{#3} - \fi - \@OUTPUTSOL{#3}} + \begingroup + \ifdim #1\p@ > 4\p@ \cctr@Warnround{#2}{\noexpand#3} \COPY{#2}{#3} + \else + \INTEGERPART{#2}{\cctr@tempa} + \ifdim \cctr@tempa\p@ = #2\p@ + \expandafter\@@@ROUND\cctr@tempa.00000.)[#1]{#3} + \else + \expandafter\@@@ROUND#200000.)[#1]{#3} + \fi + \fi + \@OUTPUTSOL{#3}} + +\def\@@@ROUND#1.#2#3#4#5#6.#7)[#8]#9{% + \ifcase #8 + \COPY{#1}{#9} \ifnum #2>4 \ADD{#1}{1}{\cctr@tempp}\COPY{\cctr@tempp}{#9} \fi + \or\COPY{#1.#2}{#9} \ifnum #3>4 \ADD{#2}{1}\cctr@tempq\COPY{#1}{\cctr@tempp} + \ifnum\cctr@tempq=10\ADD{\cctr@tempp}{1}\cctr@tempp\COPY{0}{\cctr@tempq}\fi + \COPY{\cctr@tempp.\cctr@tempq}{#9} + \fi + \or\COPY{#1.#2#3}{#9} \ifnum #4>4 \ADD{#3}1\cctr@tempq\COPY{#2}{\cctr@tempp}\COPY{#1}{\cctr@tempo} + \ifnum\cctr@tempq=10\ADD{\cctr@tempp}{1}{\cctr@tempp}\COPY{0}{\cctr@tempq}\fi + \ifnum\cctr@tempp=10\ADD{\cctr@tempo}{1}\cctr@tempo\COPY{0}{\cctr@tempp}\fi + \COPY{\cctr@tempo.\cctr@tempp\cctr@tempq}{#9} + \fi + \or\COPY{#1.#2#3#4}{#9} \ifnum #5>4 \ADD{#4}1\cctr@tempq\COPY{#3}{\cctr@tempp}\COPY{#2}{\cctr@tempo}\COPY{#1}{\cctr@tempn} + \ifnum\cctr@tempq=10\ADD{\cctr@tempp}{1}{\cctr@tempp}\COPY{0}{\cctr@tempq}\fi + \ifnum\cctr@tempp=10\ADD{\cctr@tempo}{1}\cctr@tempo\COPY{0}{\cctr@tempp}\fi + \ifnum\cctr@tempo=10\ADD{\cctr@tempn}{1}\cctr@tempn\COPY{0}{\cctr@tempo}\fi + \COPY{\cctr@tempn.\cctr@tempo\cctr@tempp\cctr@tempq}{#9} + \fi + \or\COPY{#1.#2#3#4#5}{#9} \ifnum #6>4 \ADD{#5}1\cctr@tempq\COPY{#4}{\cctr@tempp}\COPY{#3}{\cctr@tempo}\COPY{#2}{\cctr@tempn}\COPY{#1}{\cctr@tempm} + \ifnum\cctr@tempq=10\ADD{\cctr@tempp}{1}{\cctr@tempp}\COPY{0}{\cctr@tempq}\fi + \ifnum\cctr@tempp=10\ADD{\cctr@tempo}{1}\cctr@tempo\COPY{0}{\cctr@tempp}\fi + \ifnum\cctr@tempo=10\ADD{\cctr@tempn}{1}\cctr@tempn\COPY{0}{\cctr@tempo}\fi + \ifnum\cctr@tempn=10\ADD{\cctr@tempm}{1}\cctr@tempm\COPY{0}{\cctr@tempn}\fi + \COPY{\cctr@tempm.\cctr@tempn\cctr@tempo\cctr@tempp\cctr@tempq}{#9} + \fi} % \end{macrocode} % \end{macro} % \begin{macro}{\GCD} @@ -3196,9 +3245,11 @@ % \end{macrocode} % % We start with |\cctr@lengthb=5\p@| to ensure almost one iteration. +% \changes{v2.1}{2022/09/15}{Changed stop criterion on iterations to 2sp} % \begin{macrocode} \cctr@lengthb=5\p@% -% \end{macrocode} + \cctr@epsilon=2\cctr@epsilon% +% \end{macrocode} % Successive iterations % \begin{macrocode} \@whilenum \cctr@lengthb>\cctr@epsilon \do {% @@ -4400,7 +4451,7 @@ \ProvidesPackage{calculus}[2014/02/20 v.2.0] % \end{macrocode} % This package requires the calculator package. -% \begin{macrocode} +% \begin{macrocode} \RequirePackage{calculator} % \end{macrocode} % \subsection{Error and info messages} diff --git a/Master/texmf-dist/source/latex/calculator/calculator.ins b/Master/texmf-dist/source/latex/calculator/calculator.ins index 1b761991586..7708cf1e234 100644 --- a/Master/texmf-dist/source/latex/calculator/calculator.ins +++ b/Master/texmf-dist/source/latex/calculator/calculator.ins @@ -1,5 +1,5 @@ %% -%% Copyright (C) 2012, 2014 by Robert Fuster <rfuster@mat.upv.es> +%% Copyright (C) 2012, 2014, 2022 by Robert Fuster <rfuster@mat.upv.es> %% %% This work may be distributed and/or modified under the conditions of %% the LaTeX Project Public License, either version 1.3 of this license @@ -55,9 +55,9 @@ calculator<nn>.tex derived files. \Msg{*****************************************************} \Msg{* *} \Msg{* To finish the installation you have to move the *} -\Msg{* following file into a directory searched by TeX: *} +\Msg{* following files into a directory searched by TeX: *} \Msg{* *} -\Msg{* calculator.sty *} +\Msg{* calculator.sty calculus.sty *} \Msg{* *} \Msg{* (in a TDS compliant tree, something like *} \Msg{* <a texmf dir>/tex/latex/calculator/ *} diff --git a/Master/texmf-dist/tex/latex/calculator/calculator.sty b/Master/texmf-dist/tex/latex/calculator/calculator.sty index 0c8cd4a23c8..2ab4be4fa84 100644 --- a/Master/texmf-dist/tex/latex/calculator/calculator.sty +++ b/Master/texmf-dist/tex/latex/calculator/calculator.sty @@ -46,13 +46,26 @@ + \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{calculator}[2014/02/20 v.2.0] +\ProvidesPackage{calculator}[2022/09/15 v.2.1] \newdimen\cctr@lengtha \newdimen\cctr@lengthb \newdimen\cctr@epsilon \cctr@epsilon=1sp \def\cctr@logmaxnum{9.704} +\def\cctr@Warntruncate#1#2{% + \PackageWarning{calculator}% + {The optional argument in truncate \MessageBreak + must be less than 5 \MessageBreak + I copy #1 to #2 \MessageBreak without truncating}} + +\def\cctr@Warnround#1#2{% + \PackageWarning{calculator}% + {The optional argument in round \MessageBreak + must be less than 5 \MessageBreak + I copy #1 to #2 \MessageBreak without rounding}} + \def\cctr@Warndivzero#1#2{% \PackageWarning{calculator}% {Division by 0.\MessageBreak @@ -293,7 +306,7 @@ \begingroup \INTEGERDIVISION{#1}{#2}{#3}{\cctr@temp}\@OUTPUTSOL{#3}} \def\@@INTEGERPART#1.#2.#3)#4{\ifnum #11=1 \COPY{0}{#4} - \else \COPY{#1}{#4}\fi} + \else \ADD{0}{#1}{#4}\fi} \def\@INTEGERPART#1#2{\expandafter\@@INTEGERPART#1..){#2}} \def\INTEGERPART#1#2{\begingroup \ifdim #1\p@<\z@ @@ -307,8 +320,8 @@ \@INTEGERPART{#1}{#2} \fi\@OUTPUTSOL{#2}} \let\FLOOR\INTEGERPART -\def\@@FRACTIONALPART#1.#2.#3)#4{\ifnum #2=11 \COPY{0}{#4} - \else \COPY{0.#2}{#4}\fi} +\def\@@FRACTIONALPART#1.#2.#3)#4{\ifnum #21=1 \COPY{0}{#4} + \else \ADD{0}{0.#2}{#4}\fi} \def\@FRACTIONALPART#1#2{\expandafter\@@FRACTIONALPART#1..){#2}} \def\FRACTIONALPART#1#2{\begingroup \ifdim #1\p@<\z@ @@ -317,17 +330,21 @@ \else \@FRACTIONALPART{#1}{#2} \fi\@OUTPUTSOL{#2}} + \def\TRUNCATE{\@ifnextchar[\@@TRUNCATE\@TRUNCATE} \def\@TRUNCATE#1#2{\@@TRUNCATE[2]{#1}{#2}} \def\@@TRUNCATE[#1]#2#3{% \begingroup + \ifdim #1\p@ > 4\p@ \cctr@Warntruncate{#2}{\noexpand#3} \COPY{#2}{#3} + \else \INTEGERPART{#2}{\cctr@tempa} \ifdim \cctr@tempa\p@ = #2\p@ - \expandafter\@@@TRUNCATE#2.00000)[#1]{#3} + \expandafter\@@@TRUNCATE\cctr@tempa.00000.)[#1]{#3} \else \expandafter\@@@TRUNCATE#200000.)[#1]{#3} - \fi + \fi\fi \@OUTPUTSOL{#3}} + \def\@@@TRUNCATE#1.#2#3#4#5#6.#7)[#8]#9{% \ifcase #8 \COPY{#1}{#9} @@ -339,23 +356,43 @@ \def\ROUND{\@ifnextchar[\@@ROUND\@ROUND} \def\@ROUND#1#2{\@@ROUND[2]{#1}{#2}} \def\@@ROUND[#1]#2#3{% - \begingroup - \ifdim#2\p@<\z@ - \MULTIPLY{-1}{#2}{\cctr@temp} - \@@ROUND[#1]{\cctr@temp}{#3}\COPY{-#3}{#3} - \else - \@@TRUNCATE[#1]{#2}{\cctr@tempe} - \SUBTRACT{#2}{\cctr@tempe}{\cctr@tempc} - \POWER{10}{#1}{\cctr@tempb} - \MULTIPLY{\cctr@tempb}{\cctr@tempc}{\cctr@tempc} - \ifdim\cctr@tempc\p@<0.5\p@ - \else - \DIVIDE{1}{\cctr@tempb}{\cctr@tempb} - \ADD{\cctr@tempe}{\cctr@tempb}{\cctr@tempe} - \fi - \@@TRUNCATE[#1]{\cctr@tempe}{#3} - \fi - \@OUTPUTSOL{#3}} + \begingroup + \ifdim #1\p@ > 4\p@ \cctr@Warnround{#2}{\noexpand#3} \COPY{#2}{#3} + \else + \INTEGERPART{#2}{\cctr@tempa} + \ifdim \cctr@tempa\p@ = #2\p@ + \expandafter\@@@ROUND\cctr@tempa.00000.)[#1]{#3} + \else + \expandafter\@@@ROUND#200000.)[#1]{#3} + \fi + \fi + \@OUTPUTSOL{#3}} + +\def\@@@ROUND#1.#2#3#4#5#6.#7)[#8]#9{% + \ifcase #8 + \COPY{#1}{#9} \ifnum #2>4 \ADD{#1}{1}{\cctr@tempp}\COPY{\cctr@tempp}{#9} \fi + \or\COPY{#1.#2}{#9} \ifnum #3>4 \ADD{#2}{1}\cctr@tempq\COPY{#1}{\cctr@tempp} + \ifnum\cctr@tempq=10\ADD{\cctr@tempp}{1}\cctr@tempp\COPY{0}{\cctr@tempq}\fi + \COPY{\cctr@tempp.\cctr@tempq}{#9} + \fi + \or\COPY{#1.#2#3}{#9} \ifnum #4>4 \ADD{#3}1\cctr@tempq\COPY{#2}{\cctr@tempp}\COPY{#1}{\cctr@tempo} + \ifnum\cctr@tempq=10\ADD{\cctr@tempp}{1}{\cctr@tempp}\COPY{0}{\cctr@tempq}\fi + \ifnum\cctr@tempp=10\ADD{\cctr@tempo}{1}\cctr@tempo\COPY{0}{\cctr@tempp}\fi + \COPY{\cctr@tempo.\cctr@tempp\cctr@tempq}{#9} + \fi + \or\COPY{#1.#2#3#4}{#9} \ifnum #5>4 \ADD{#4}1\cctr@tempq\COPY{#3}{\cctr@tempp}\COPY{#2}{\cctr@tempo}\COPY{#1}{\cctr@tempn} + \ifnum\cctr@tempq=10\ADD{\cctr@tempp}{1}{\cctr@tempp}\COPY{0}{\cctr@tempq}\fi + \ifnum\cctr@tempp=10\ADD{\cctr@tempo}{1}\cctr@tempo\COPY{0}{\cctr@tempp}\fi + \ifnum\cctr@tempo=10\ADD{\cctr@tempn}{1}\cctr@tempn\COPY{0}{\cctr@tempo}\fi + \COPY{\cctr@tempn.\cctr@tempo\cctr@tempp\cctr@tempq}{#9} + \fi + \or\COPY{#1.#2#3#4#5}{#9} \ifnum #6>4 \ADD{#5}1\cctr@tempq\COPY{#4}{\cctr@tempp}\COPY{#3}{\cctr@tempo}\COPY{#2}{\cctr@tempn}\COPY{#1}{\cctr@tempm} + \ifnum\cctr@tempq=10\ADD{\cctr@tempp}{1}{\cctr@tempp}\COPY{0}{\cctr@tempq}\fi + \ifnum\cctr@tempp=10\ADD{\cctr@tempo}{1}\cctr@tempo\COPY{0}{\cctr@tempp}\fi + \ifnum\cctr@tempo=10\ADD{\cctr@tempn}{1}\cctr@tempn\COPY{0}{\cctr@tempo}\fi + \ifnum\cctr@tempn=10\ADD{\cctr@tempm}{1}\cctr@tempm\COPY{0}{\cctr@tempn}\fi + \COPY{\cctr@tempm.\cctr@tempn\cctr@tempo\cctr@tempp\cctr@tempq}{#9} + \fi} \def\GCD#1#2#3{% \begingroup \ABSVALUE{#1}{\cctr@tempa} @@ -748,6 +785,7 @@ \def\@BASICLOG#1#2{\begingroup \SUBTRACT{#1}{1}{\cctr@tempw} \cctr@lengthb=5\p@% + \cctr@epsilon=2\cctr@epsilon% \@whilenum \cctr@lengthb>\cctr@epsilon \do {% \COPY{\cctr@tempw}{\cctr@tempoldw} \EXP{\cctr@tempw}{\cctr@tempxw} diff --git a/Master/texmf-dist/tex/latex/calculator/calculus.sty b/Master/texmf-dist/tex/latex/calculator/calculus.sty index 86010b080af..a6ba29255f4 100644 --- a/Master/texmf-dist/tex/latex/calculator/calculus.sty +++ b/Master/texmf-dist/tex/latex/calculator/calculus.sty @@ -46,6 +46,7 @@ + \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{calculus}[2014/02/20 v.2.0] \RequirePackage{calculator} |