diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3fp-trig.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3fp-trig.dtx | 54 |
1 files changed, 22 insertions, 32 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-trig.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-trig.dtx index 73c97574dd4..2bccf65847a 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-2017 The LaTeX3 Project +%% File: l3fp-trig.dtx Copyright (C) 2011-2018 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 @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2017/12/16} +% \date{Released 2018/02/21} % % \maketitle % @@ -1087,44 +1087,34 @@ % % \subsubsection{Arctangent and arccotangent} % -% \begin{macro}[EXP]{\@@_atan_o:Nw, \@@_acot_o:Nw} -% \begin{macro}[EXP]{\@@_atan_dispatch_o:NNnNw} +% \begin{macro}[EXP]{\@@_atan_o:Nw, \@@_acot_o:Nw, \@@_atan_default:w} % The parsing step manipulates \texttt{atan} and \texttt{acot} like % \texttt{min} and \texttt{max}, reading in an array of operands, but % also leaves \cs{use_i:nn} or \cs{use_ii:nn} depending on whether the -% 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: $\operatorname{atan}(y) = \operatorname{atan}(y, 1) = \operatorname{acot}(1, y)$ and -% $\operatorname{acot}(x) = \operatorname{atan}(1, x) = \operatorname{acot}(x, 1)$. +% result should be given in radians or in degrees. The helper +% \cs{@@_parse_function_one_two:nnw} checks that the operand is one or +% two floating point numbers (not tuples) and leaves its second +% argument or its tail accordingly (its first argument is used for +% error messages). More precisely if we are given a single floating +% point number \cs{@@_atan_default:w} places \cs{c_one_fp} (expanded) +% after it; otherwise \cs{@@_atan_default:w} is omitted by +% \cs{@@_parse_function_one_two:nnw}. % \begin{macrocode} -\cs_new:Npn \@@_atan_o:Nw +\cs_new:Npn \@@_atan_o:Nw #1 { - \@@_atan_dispatch_o:NNnNw - \@@_acotii_o:Nww \@@_atanii_o:Nww { atan } + \@@_parse_function_one_two:nnw + { #1 { atan } { atand } } + { \@@_atan_default:w \@@_atanii_o:Nww #1 } } -\cs_new:Npn \@@_acot_o:Nw +\cs_new:Npn \@@_acot_o:Nw #1 { - \@@_atan_dispatch_o:NNnNw - \@@_atanii_o:Nww \@@_acotii_o:Nww { acot } - } -\cs_new:Npn \@@_atan_dispatch_o:NNnNw #1#2#3#4#5@ - { - \if_case:w - \__int_eval:w \@@_array_count:n {#5} - 1 \__int_eval_end: - \exp_after:wN #1 \exp_after:wN #4 \c_one_fp #5 - \exp:w - \or: #2 #4 #5 \exp:w - \else: - \__msg_kernel_expandable_error:nnnnn - { kernel } { fp-num-args } { #3() } { 1 } { 2 } - \exp_after:wN \c_nan_fp \exp:w - \fi: - \exp_after:wN \exp_end: + \@@_parse_function_one_two:nnw + { #1 { acot } { acotd } } + { \@@_atan_default:w \@@_acotii_o:Nww #1 } } +\cs_new:Npx \@@_atan_default:w #1#2#3 @ { #1 #2 #3 \c_one_fp @ } % \end{macrocode} % \end{macro} -% \end{macro} % % \begin{macro}[EXP]{\@@_atanii_o:Nww, \@@_acotii_o:Nww} % If either operand is \texttt{nan}, we return it. If both are @@ -1139,7 +1129,7 @@ % \cs{@@_acotii_o:ww} simply reverses its two arguments. % \begin{macrocode} \cs_new:Npn \@@_atanii_o:Nww - #1 \s_@@ \@@_chk:w #2#3#4; \s_@@ \@@_chk:w #5 + #1 \s_@@ \@@_chk:w #2#3#4; \s_@@ \@@_chk:w #5 #6 @ { \if_meaning:w 3 #2 \@@_case_return_i_o:ww \fi: \if_meaning:w 3 #5 \@@_case_return_ii_o:ww \fi: @@ -1156,7 +1146,7 @@ \fi: \@@_atan_normal_o:NNnwNnw #1 \s_@@ \@@_chk:w #2#3#4; - \s_@@ \@@_chk:w #5 + \s_@@ \@@_chk:w #5 #6 } \cs_new:Npn \@@_acotii_o:Nww #1#2; #3; { \@@_atanii_o:Nww #1#3; #2; } |