diff options
author | Karl Berry <karl@freefriends.org> | 2013-11-22 00:05:28 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-11-22 00:05:28 +0000 |
commit | 4efb0e288e61307337a1593f83dead03178acc61 (patch) | |
tree | 1de51740df3962c81edef97135bac249b41d3fe1 /Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx | |
parent | 9dd6af228b319f176777f85b0b551eda0df6cfbe (diff) |
l3 (19nov13)
git-svn-id: svn://tug.org/texlive/trunk@32204 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx | 60 |
1 files changed, 29 insertions, 31 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx index 6c7991c4027..49f9630c5f3 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%% File: l3fp-logic.dtx Copyright (C) 2011-2012 The LaTeX3 Project +%% File: l3fp-logic.dtx Copyright (C) 2011-2013 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 @@ -82,9 +82,8 @@ % \begin{itemize} % \item \cs{@@_compare_npos:nwnw} \Arg{expo_1} \meta{body_1} |;| % \Arg{expo_2} \meta{body_2} |;| -% \item \cs{@@_max_o:w} \meta{floating point array} -% \item \cs{@@_min_o:w} \meta{floating point array} -% \item \cs{@@_!_o:w} \meta{floating point} +% \item \cs{@@_minmax_o:Nw} \meta{sign} \meta{floating point array} +% \item \cs{@@_not_o:w} |?| \meta{floating point array} (with one floating point number only) % \item \cs{@@_\string&_o:ww} \meta{floating point} \meta{floating point} % \item \cs{@@_\string|_o:ww} \meta{floating point} \meta{floating point} % \item \cs{@@_ternary:NwwN}, \cs{@@_ternary_auxi:NwwN}, @@ -320,28 +319,26 @@ % % \subsection{Extrema} % -% \begin{macro}[int, EXP]{\@@_max_o:w, \@@_min_o:w} -% The maximum (minimum) of an array of floating point numbers is -% computed by reading them sequentially, keeping track of the largest -% (smallest) number found so far. We start with $-\infty$ ($\infty$) -% since every number is larger (smaller) than that. The weird fp-like -% trailing marker breaks the loop correctly: see the precise +% \begin{macro}[int, EXP]{\@@_minmax_o:Nw} +% The argument~|#1| is $2$~to find the maximum of an array~|#2| of +% floating point numbers, and $0$~to find the minimum. We read +% numbers sequentially, keeping track of the largest (smallest) number +% found so far. If numbers are equal (for instance~$\pm0$), the first +% is kept. We append $-\infty$ ($\infty$), for the case of an empty +% array, currently impossible. Since no number is smaller (larger) +% than that, it will never alter the maximum (minimum). The weird +% fp-like trailing marker breaks the loop correctly: see the precise % definition of \cs{@@_minmax_loop:Nww}. % \begin{macrocode} -\cs_new:Npn \@@_max_o:w #1 @ +\cs_new:Npn \@@_minmax_o:Nw #1#2 @ { - \exp_after:wN \@@_minmax_loop:Nww - \exp_after:wN \c_minus_one - \c_minus_inf_fp - #1 - \s_@@ \@@_chk:w { 3 \@@_minmax_break_o:w } ; - } -\cs_new:Npn \@@_min_o:w #1 @ - { - \exp_after:wN \@@_minmax_loop:Nww - \exp_after:wN \c_one - \c_inf_fp - #1 + \if_meaning:w 0 #1 + \exp_after:wN \@@_minmax_loop:Nww \exp_after:wN \c_one + \else: + \exp_after:wN \@@_minmax_loop:Nww \exp_after:wN \c_minus_one + \fi: + #2 + \s_@@ \@@_chk:w 2 #1 \s_@@_exact ; \s_@@ \@@_chk:w { 3 \@@_minmax_break_o:w } ; } % \end{macrocode} @@ -407,13 +404,14 @@ % % \subsection{Boolean operations} % -% \begin{macro}[int, EXP]{\@@_!_o:w} +% \begin{macro}[int, EXP]{\@@_not_o:w} % Return \texttt{true} or \texttt{false}, with two expansions, one to -% exit the conditional, and one to please \pkg{l3fp-parse}. +% exit the conditional, and one to please \pkg{l3fp-parse}. The first +% argument is provided by \pkg{l3fp-parse} and is ignored. % \begin{macrocode} -\cs_new:cpn { @@_!_o:w } \s_@@ \@@_chk:w #1#2; +\cs_new:cpn { @@_not_o:w } #1 \s_@@ \@@_chk:w #2#3; @ { - \if_meaning:w 0 #1 + \if_meaning:w 0 #2 \exp_after:wN \exp_after:wN \exp_after:wN \c_one_fp \else: \exp_after:wN \exp_after:wN \exp_after:wN \c_zero_fp @@ -480,12 +478,12 @@ \@@_exp_after_array_f:w #3 \s_@@_stop \exp_after:wN @ \tex_romannumeral:D - \@@_parse_until:Nw \c_two + \@@_parse_operand:Nw \c_two \@@_parse_expand:w \else: \__msg_kernel_expandable_error:nnnn { kernel } { fp-missing } { : } { ~for~?: } - \exp_after:wN \@@_parse_until_test:NwN + \exp_after:wN \@@_parse_continue:NwN \exp_after:wN #1 \tex_romannumeral:D -`0 \@@_exp_after_array_f:w #3 \s_@@_stop @@ -508,7 +506,7 @@ \cs_new:Npn \@@_ternary_map_break: #1 \@@_ternary_break_point:n #2 {#2} \cs_new:Npn \@@_ternary_auxi:NwwN #1#2@#3@#4 { - \exp_after:wN \@@_parse_until_test:NwN + \exp_after:wN \@@_parse_continue:NwN \exp_after:wN #1 \tex_romannumeral:D -`0 \@@_exp_after_array_f:w #2 \s_@@_stop @@ -516,7 +514,7 @@ } \cs_new:Npn \@@_ternary_auxii:NwwN #1#2@#3@#4 { - \exp_after:wN \@@_parse_until_test:NwN + \exp_after:wN \@@_parse_continue:NwN \exp_after:wN #1 \tex_romannumeral:D -`0 \@@_exp_after_array_f:w #3 \s_@@_stop |