diff options
author | Karl Berry <karl@freefriends.org> | 2014-05-05 22:01:18 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2014-05-05 22:01:18 +0000 |
commit | d78a5a4de1e73a2151e8ed2635a199d928ccb559 (patch) | |
tree | ca490a3efa7d3614793427f850ec1aeb6bf971f1 /Master/texmf-dist/source/latex/l3kernel/l3fp-trig.dtx | |
parent | b41cac6cebc8095cf8eaf7e84f8a2d5f63b7be38 (diff) |
latex3 (5may14)
git-svn-id: svn://tug.org/texlive/trunk@33859 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3fp-trig.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3fp-trig.dtx | 91 |
1 files changed, 45 insertions, 46 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-trig.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-trig.dtx index 11a058130d1..11415825d54 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-trig.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-trig.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%% File: l3fp-trig.dtx Copyright (C) 2011-2013 The LaTeX3 Project +%% File: l3fp-trig.dtx Copyright (C) 2011-2014 The LaTeX3 Project %% %% It may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this @@ -35,10 +35,9 @@ %% % %<*driver> -\RequirePackage{l3bootstrap} -\GetIdInfo$Id: l3fp-trig.dtx 4617 2013-12-14 12:37:59Z bruno $ - {L3 Floating-point trigonometric functions} \documentclass[full]{l3doc} +\GetIdInfo$Id: l3fp-trig.dtx 4721 2014-05-03 13:54:09Z joseph $ + {L3 Floating-point trigonometric functions} \begin{document} \DocInput{\jobname.dtx} \end{document} @@ -469,7 +468,7 @@ % $0.6\cdot\text{ulp}$ in all cases. % % ^^A todo: if the exponent range is reduced, store 1/2pi as a simple tl -% \begin{macro}[aux, EXP]{\@@_trig_inverse_two_pi:} +% \begin{variable}[aux, EXP]{\@@_trig_inverse_two_pi:} % This macro expands to |,,!| or~|,!| followed by $10112$~decimals of % $10^{-16}/(2\pi)$. The number of decimals we really need is the % maximum exponent plus the number of digits we will need later,~$52$, @@ -981,28 +980,28 @@ % All inverse trigonometric functions (arcsine, arccosine, arctangent, % arccotangent, arccosecant, and arcsecant) are based on a function % often denoted \texttt{atan2}. This function is accessed directly by -% feeding two arguments to arctangent, and is defined by \(\atan(y, x) = -% \atan(y/x)\) for generic \(y\) and~\(x\). Its advantages over the +% feeding two arguments to arctangent, and is defined by \(\operatorname{atan}(y, x) = +% \operatorname{atan}(y/x)\) for generic \(y\) and~\(x\). Its advantages over the % conventional arctangent is that it takes values in $[-\pi,\pi]$ rather % than $[-\pi/2,\pi/2]$, and that it is better behaved in boundary % cases. Other inverse trigonometric functions are expressed in terms -% of \(\atan\) as +% of \(\operatorname{atan}\) as % \begin{align} -% \operatorname{acos} x & = \atan(\sqrt{1-x^2}, x) \\ -% \operatorname{asin} x & = \atan(x, \sqrt{1-x^2}) \\ -% \operatorname{asec} x & = \atan(\sqrt{x^2-1}, 1) \\ -% \operatorname{acsc} x & = \atan(1, \sqrt{x^2-1}) \\ -% \operatorname{atan} x & = \atan(x, 1) \\ -% \operatorname{acot} x & = \atan(1, x) . +% \operatorname{acos} x & = \operatorname{atan}(\sqrt{1-x^2}, x) \\ +% \operatorname{asin} x & = \operatorname{atan}(x, \sqrt{1-x^2}) \\ +% \operatorname{asec} x & = \operatorname{atan}(\sqrt{x^2-1}, 1) \\ +% \operatorname{acsc} x & = \operatorname{atan}(1, \sqrt{x^2-1}) \\ +% \operatorname{atan} x & = \operatorname{atan}(x, 1) \\ +% \operatorname{acot} x & = \operatorname{atan}(1, x) . % \end{align} % Rather than introducing a new function, \texttt{atan2}, the arctangent % function \texttt{atan} is overloaded: it can take one or two % arguments. In the comments below, following many texts, we call the -% first argument~$y$ and the second~$x$, because $\atan(y, x) = \atan(y +% first argument~$y$ and the second~$x$, because $\operatorname{atan}(y, x) = \operatorname{atan}(y % / x)$ is the angular coordinate of the point $(x, y)$. % % As for direct trigonometric functions, the first step in computing -% $\atan(y, x)$ is argument reduction. The sign of~$y$ will give that +% $\operatorname{atan}(y, x)$ is argument reduction. The sign of~$y$ will give that % of the result. We distinguish eight regions where the point $(x, % \lvert y\rvert)$ can lie, of angular size roughly $\pi/8$, % characterized by their ``octant'', between $0$ and~$7$ included. In @@ -1012,29 +1011,29 @@ % arctangent (we assume $y>0$: otherwise replace $y$ by~$-y$ below): % \begin{itemize} % \item[0] $0 < \lvert y\rvert < 0.41421 x$, then -% $\atan\frac{\lvert y\rvert}{x}$ +% $\operatorname{atan}\frac{\lvert y\rvert}{x}$ % is given by a nicely convergent Taylor series; % \item[1] $0 < 0.41421 x < \lvert y\rvert < x$, then -% $\atan\frac{\lvert y\rvert}{x} -% = \frac{\pi}{4}-\atan\frac{x-\lvert y\rvert}{x+\lvert y\rvert}$; +% $\operatorname{atan}\frac{\lvert y\rvert}{x} +% = \frac{\pi}{4}-\operatorname{atan}\frac{x-\lvert y\rvert}{x+\lvert y\rvert}$; % \item[2] $0 < 0.41421 \lvert y\rvert < x < \lvert y\rvert$, then -% $\atan\frac{\lvert y\rvert}{x} -% = \frac{\pi}{4}+\atan\frac{-x+\lvert y\rvert}{x+\lvert y\rvert}$; +% $\operatorname{atan}\frac{\lvert y\rvert}{x} +% = \frac{\pi}{4}+\operatorname{atan}\frac{-x+\lvert y\rvert}{x+\lvert y\rvert}$; % \item[3] $0 < x < 0.41421 \lvert y\rvert$, then -% $\atan\frac{\lvert y\rvert}{x} -% = \frac{\pi}{2}-\atan\frac{x}{\lvert y\rvert}$; +% $\operatorname{atan}\frac{\lvert y\rvert}{x} +% = \frac{\pi}{2}-\operatorname{atan}\frac{x}{\lvert y\rvert}$; % \item[4] $0 < -x < 0.41421 \lvert y\rvert$, then -% $\atan\frac{\lvert y\rvert}{x} -% = \frac{\pi}{2}+\atan\frac{-x}{\lvert y\rvert}$; +% $\operatorname{atan}\frac{\lvert y\rvert}{x} +% = \frac{\pi}{2}+\operatorname{atan}\frac{-x}{\lvert y\rvert}$; % \item[5] $0 < 0.41421 \lvert y\rvert < -x < \lvert y\rvert$, then -% $\atan\frac{\lvert y\rvert}{x} -% =\frac{3\pi}{4}-\atan\frac{x+\lvert y\rvert}{-x+\lvert y\rvert}$; +% $\operatorname{atan}\frac{\lvert y\rvert}{x} +% =\frac{3\pi}{4}-\operatorname{atan}\frac{x+\lvert y\rvert}{-x+\lvert y\rvert}$; % \item[6] $0 < -0.41421 x < \lvert y\rvert < -x$, then -% $\atan\frac{\lvert y\rvert}{x} -% =\frac{3\pi}{4}+\atan\frac{-x-\lvert y\rvert}{-x+\lvert y\rvert}$; +% $\operatorname{atan}\frac{\lvert y\rvert}{x} +% =\frac{3\pi}{4}+\operatorname{atan}\frac{-x-\lvert y\rvert}{-x+\lvert y\rvert}$; % \item[7] $0 < \lvert y\rvert < -0.41421 x$, then -% $\atan\frac{\lvert y\rvert}{x} -% = \pi-\atan\frac{\lvert y\rvert}{-x}$. +% $\operatorname{atan}\frac{\lvert y\rvert}{x} +% = \pi-\operatorname{atan}\frac{\lvert y\rvert}{-x}$. % \end{itemize} % In the following, we will denote by~$z$ the ratio among % $\lvert\frac{y}{x}\rvert$, $\lvert\frac{x}{y}\rvert$, @@ -1051,8 +1050,8 @@ % result should be given in radians or in degrees. Here, we dispatch % according to the number of arguments. The one-argument versions of % arctangent and arccotangent are special cases of the two-argument -% ones: $\atan(y) = \atan(y, 1) = \operatorname{acot}(1, y)$ and -% $\operatorname{acot}(x) = \atan(1, x) = \operatorname{acot}(x, 1)$. +% ones: $\operatorname{atan}(y) = \operatorname{atan}(y, 1) = \operatorname{acot}(1, y)$ and +% $\operatorname{acot}(x) = \operatorname{atan}(1, x) = \operatorname{acot}(x, 1)$. % \begin{macrocode} \cs_new_nopar:Npn \@@_atan_o:Nw { @@ -1091,7 +1090,7 @@ % other, and we call \cs{@@_atan_inf_o:NNNw} with either an argument % of~$4$, leading to the values $\pm\pi/2$ (in degrees,~$\pm 90$), % or~$0$, leading to $\{\pm 0, \pm\pi\}$ (in degrees, $\{\pm 0,\pm -% 180\}$). Since $\operatorname{acot}(x, y) = \atan(y, x)$, +% 180\}$). Since $\operatorname{acot}(x, y) = \operatorname{atan}(y, x)$, % \cs{@@_acotii_o:ww} simply reverses its two arguments. % \begin{macrocode} \cs_new:Npn \@@_atanii_o:Nww @@ -1124,9 +1123,9 @@ % on the signs, and its value is a multiple of $\pi/4$. We use the % same auxiliary as for normal numbers, % \cs{@@_atan_combine_o:NwwwwwN}, with arguments the final sign~|#2|; -% the octant~|#3|; $\atan z/z=1$ as a fixed point number; $z=0$~as a +% the octant~|#3|; $\operatorname{atan} z/z=1$ as a fixed point number; $z=0$~as a % fixed point number; and $z=0$~as an extended-precision number. -% Given the values we provide, $\atan z$ will be computed to be~$0$, +% Given the values we provide, $\operatorname{atan} z$ will be computed to be~$0$, % and the result will be $[|#3|/2]\cdot\pi/4$ if the sign~|#5| of~$x$ % is positive, and $[(7-|#3|)/2]\cdot\pi/4$ for negative~$x$, where % the divisions are rounded up. @@ -1149,7 +1148,7 @@ % extended-precision numbers, that is, a sign, an exponent ending with % a comma, and a six-block mantissa ending with a semi-colon. This % extended precision is required by other inverse trigonometric -% functions, to compute things like $\atan(x,\sqrt{1-x^2})$ without +% functions, to compute things like $\operatorname{atan}(x,\sqrt{1-x^2})$ without % intermediate rounding errors. % \begin{macrocode} \cs_new_protected:Npn \@@_atan_normal_o:NNnwNnw @@ -1166,7 +1165,7 @@ % This receives: the sign~|#1| of~$y$, its exponent~|#2|, its $24$ % digits~|#3| in groups of~$4$, and similarly for~$x$. We prepare to % call \cs{@@_atan_combine_o:NwwwwwN} which expects the sign~|#1|, the -% octant, the ratio $(\atan z)/z = 1 - \cdots$, and the value of~$z$, +% octant, the ratio $(\operatorname{atan} z)/z = 1 - \cdots$, and the value of~$z$, % both as a fixed point number and as an extended-precision floating % point number with a mantissa in $[0.01,1)$. For now, we place |#1| % as a first argument, and start an integer expression for the octant. @@ -1205,9 +1204,9 @@ % started with is closer to the diagonals $\{\lvert y\rvert = \lvert % x\rvert\}$ than to the axes $\{xy = 0\}$. In that case, the octant % is~$1$ (possibly combined with the $7-$ and $3-$ inserted earlier) -% and we wish to compute $\atan\frac{b-a}{a+b}$. Otherwise, the +% and we wish to compute $\operatorname{atan}\frac{b-a}{a+b}$. Otherwise, the % octant is~$0$ (again, combined with earlier terms) and we wish to -% compute $\atan\frac{a}{b}$. In any case, call \cs{@@_atan_auxi:ww} +% compute $\operatorname{atan}\frac{a}{b}$. In any case, call \cs{@@_atan_auxi:ww} % followed by~$z$, as a comma-delimited exponent and a fixed point % number. % \begin{macrocode} @@ -1261,12 +1260,12 @@ % % \begin{macro}[aux, EXP] % {\@@_atan_Taylor_loop:www, \@@_atan_Taylor_break:w} -% We compute the series of $(\atan z)/z$. A typical intermediate +% We compute the series of $(\operatorname{atan} z)/z$. A typical intermediate % stage has $|#1|=2k-1$, $|#2| = % \frac{1}{2k+1}-z^2(\frac{1}{2k+3}-z^2(\cdots-z^2\frac{1}{39}))$, and % $|#3|=z^2$. To go to the next step $k\to k-1$, we compute % $\frac{1}{2k-1}$, then subtract from it $z^2$ times |#2|. The loop -% stops when $k=0$: then |#2| is $(\atan z)/z$, and there is a need to +% stops when $k=0$: then |#2| is $(\operatorname{atan} z)/z$, and there is a need to % clean up all the unnecessary data, end the integer expression % computing the octant with a semicolon, and leave the result~|#2| % afterwards. @@ -1293,7 +1292,7 @@ % \begin{macro}[aux, EXP] % {\@@_atan_combine_o:NwwwwwN, \@@_atan_combine_aux:ww} % This receives a \meta{sign}, an \meta{octant}, a fixed point value -% of $(\atan z)/z$, a fixed point number~$z$, and another +% of $(\operatorname{atan} z)/z$, a fixed point number~$z$, and another % representation of~$z$, as an \meta{exponent} and the fixed point % number $10^{-\meta{exponent}} z$, followed by either \cs{use_i:nn} % (when working in radians) or \cs{use_ii:nn} (when working in @@ -1302,14 +1301,14 @@ % \meta{sign} \left( % \left\lceil\frac{\meta{octant}}{2}\right\rceil % \frac{\pi}{4} -% + (-1)^{\meta{octant}} \frac{\atan z}{z} \cdot z\right) \,, +% + (-1)^{\meta{octant}} \frac{\operatorname{atan} z}{z} \cdot z\right) \,, % \end{equation} % multiplied by $180/\pi$ if working in degrees, and using in any case % the most appropriate representation of~$z$. The floating point % result is passed to \cs{@@_sanitize:Nw}, which checks for overflow % or underflow. If the octant is~$0$, leave the exponent~|#5| for -% \cs{@@_sanitize:Nw}, and multiply $|#3|=\frac{\atan z}{z}$ -% with~|#6|, the adjusted~$z$. Otherwise, multiply $|#3|=\frac{\atan +% \cs{@@_sanitize:Nw}, and multiply $|#3|=\frac{\operatorname{atan} z}{z}$ +% with~|#6|, the adjusted~$z$. Otherwise, multiply $|#3|=\frac{\operatorname{atan} % z}{z}$ with $|#4|=z$, then compute the appropriate multiple of % $\frac{\pi}{4}$ and add or subtract the product $|#3|\cdot|#4|$. In % both cases, convert to a floating point with |