diff options
Diffstat (limited to 'macros/latex-dev/required/l3kernel/l3fp-logic.dtx')
-rw-r--r-- | macros/latex-dev/required/l3kernel/l3fp-logic.dtx | 120 |
1 files changed, 64 insertions, 56 deletions
diff --git a/macros/latex-dev/required/l3kernel/l3fp-logic.dtx b/macros/latex-dev/required/l3kernel/l3fp-logic.dtx index 6c21d24386..29b149498b 100644 --- a/macros/latex-dev/required/l3kernel/l3fp-logic.dtx +++ b/macros/latex-dev/required/l3kernel/l3fp-logic.dtx @@ -42,7 +42,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2025-01-14} +% \date{Released 2025-01-18} % % \maketitle % @@ -75,8 +75,8 @@ % \subsection{Syntax of internal functions} % % \begin{itemize} -% \item \cs{@@_compare_npos:nwnw} \Arg{expo_1} \meta{body_1} |;| -% \Arg{expo_2} \meta{body_2} |;| +% \item \cs{@@_compare_npos:nwnw} \Arg{expo_1} \meta{body_1} \cs{@@_sep:} +% \Arg{expo_2} \meta{body_2} \cs{@@_sep:} % \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{@@_&_o:ww} \meta{floating point} \meta{floating point} @@ -123,7 +123,7 @@ \exp_after:wN \@@_compare_return:w \exp:w \exp_end_continue_f:w \@@_parse:n {#1} } -\cs_new:Npn \@@_compare_return:w #1#2#3; +\cs_new:Npn \@@_compare_return:w #1#2#3\@@_sep: { \if_charcode:w 0 \@@_if_type_fp:NTwFw @@ -156,10 +156,10 @@ \prg_return_false: \fi: } -\cs_new:Npn \@@_compare_aux:wn #1; #2 +\cs_new:Npn \@@_compare_aux:wn #1\@@_sep: #2 { \exp_after:wN \@@_compare_back_any:ww - \exp:w \exp_end_continue_f:w \@@_parse:n {#2} #1; + \exp:w \exp_end_continue_f:w \@@_parse:n {#2} #1\@@_sep: } % \end{macrocode} % \end{macro} @@ -167,7 +167,7 @@ % % \begin{macro}[EXP]{\@@_compare_back:ww, \@@_bcmp:ww, \@@_compare_back_any:ww, \@@_compare_nan:w} % \begin{quote} -% \cs{@@_compare_back_any:ww} \meta{y} |;| \meta{x} |;| +% \cs{@@_compare_back_any:ww} \meta{y} \cs{@@_sep:} \meta{x} \cs{@@_sep:} % \end{quote} % Expands (in the same way as \cs{int_eval:n}) to $-1$ if $x<y$, $0$ % if $x=y$, $1$ if $x>y$, and $2$ otherwise (denoted as $x?y$). If @@ -180,7 +180,7 @@ % a different type, the highest type is a larger number. Finally, if % $y\leq 0$, then $x>y$, unless both are zero. % \begin{macrocode} -\cs_new:Npn \@@_compare_back:ww #1#2; #3#4; +\cs_new:Npn \@@_compare_back:ww #1#2\@@_sep: #3#4\@@_sep: { \cs:w @@ @@ -189,9 +189,9 @@ \@@_type_from_scan:N #3 :ww \cs_end: - #1#2; #3#4; + #1#2\@@_sep: #3#4\@@_sep: } -\cs_new:Npn \@@_compare_back_any:ww #1#2; #3 +\cs_new:Npn \@@_compare_back_any:ww #1#2\@@_sep: #3 { \@@_if_type_fp:NTwFw #1 { \@@_if_type_fp:NTwFw #3 \use_i:nn \s_@@ \use_ii:nn \s_@@_stop } @@ -206,11 +206,11 @@ :ww \cs_end: } - #1#2 ; #3 + #1#2 \@@_sep: #3 } \cs_new:Npn \@@_bcmp:ww - \s_@@ \@@_chk:w #1 #2 #3; - \s_@@ \@@_chk:w #4 #5 #6; + \s_@@ \@@_chk:w #1 #2 #3\@@_sep: + \s_@@ \@@_chk:w #4 #5 #6\@@_sep: { \int_value:w \if_meaning:w 3 #1 \exp_after:wN \@@_compare_nan:w \fi: @@ -219,7 +219,7 @@ \if_meaning:w #2 #5 \if_meaning:w #1 #4 \if_meaning:w 1 #1 - \@@_compare_npos:nwnw #6; #3; + \@@_compare_npos:nwnw #6\@@_sep: #3\@@_sep: \else: 0 \fi: @@ -247,30 +247,30 @@ % and if any don't match return~$2$ (as \cs{int_value:w} |02| % \cs{exp_stop_f:}). % \begin{macrocode} -\cs_new:Npn \@@_compare_back_tuple:ww #1; #2; { 2 } -\cs_new:Npn \@@_tuple_compare_back:ww #1; #2; { 2 } +\cs_new:Npn \@@_compare_back_tuple:ww #1\@@_sep: #2\@@_sep: { 2 } +\cs_new:Npn \@@_tuple_compare_back:ww #1\@@_sep: #2\@@_sep: { 2 } \cs_new:Npn \@@_tuple_compare_back_tuple:ww - \s_@@_tuple \@@_tuple_chk:w #1; - \s_@@_tuple \@@_tuple_chk:w #2; + \s_@@_tuple \@@_tuple_chk:w #1\@@_sep: + \s_@@_tuple \@@_tuple_chk:w #2\@@_sep: { \int_compare:nNnTF { \@@_array_count:n {#1} } = { \@@_array_count:n {#2} } { \int_value:w 0 \@@_tuple_compare_back_loop:w - #1 { \s_@@ \prg_break: } ; @ - #2 { \s_@@ \prg_break: } ; + #1 { \s_@@ \prg_break: } \@@_sep: @ + #2 { \s_@@ \prg_break: } \@@_sep: \prg_break_point: \exp_stop_f: } { 2 } } -\cs_new:Npn \@@_tuple_compare_back_loop:w #1#2 ; #3 @ #4#5 ; +\cs_new:Npn \@@_tuple_compare_back_loop:w #1#2 \@@_sep: #3 @ #4#5 \@@_sep: { \use_none:n #1 \use_none:n #4 \if_int_compare:w - \@@_compare_back_any:ww #1 #2 ; #4 #5 ; = \c_zero_int + \@@_compare_back_any:ww #1 #2 \@@_sep: #4 #5 \@@_sep: = \c_zero_int \else: 2 \exp_after:wN \prg_break: \fi: @@ -284,8 +284,8 @@ % \begin{macro}[EXP]{\@@_compare_significand:nnnnnnnn} % \begin{quote} % \cs{@@_compare_npos:nwnw} -% \Arg{expo_1} \meta{body_1} |;| -% \Arg{expo_2} \meta{body_2} |;| +% \Arg{expo_1} \meta{body_1} \cs{@@_sep:} +% \Arg{expo_2} \meta{body_2} \cs{@@_sep:} % \end{quote} % Within an \cs{int_value:w} \ldots{} \cs{exp_stop_f:} construction, % this expands to $0$ if the two numbers are equal, $-1$ if the first @@ -296,7 +296,7 @@ % first $8$ digits coincide, the next $8$ decide. Otherwise, the % first $8$ digits are compared. % \begin{macrocode} -\cs_new:Npn \@@_compare_npos:nwnw #1#2; #3#4; +\cs_new:Npn \@@_compare_npos:nwnw #1#2\@@_sep: #3#4\@@_sep: { \if_int_compare:w #1 = #3 \exp_stop_f: \@@_compare_significand:nnnnnnnn #2 #4 @@ -427,20 +427,22 @@ % progress. Conversion to decimal is done just before calling the % user's function. % \begin{macrocode} -\cs_new:Npn \@@_step:wwwN #1#2; #3#4; #5#6; #7 +\cs_new:Npn \@@_step:wwwN #1#2\@@_sep: #3#4\@@_sep: #5#6\@@_sep: #7 { \@@_if_type_fp:NTwFw #1 { } \s_@@ \prg_break: \s_@@_stop \@@_if_type_fp:NTwFw #3 { } \s_@@ \prg_break: \s_@@_stop \@@_if_type_fp:NTwFw #5 { } \s_@@ \prg_break: \s_@@_stop - \use_i:nnnn { \@@_step_fp:wwwN #1#2; #3#4; #5#6; #7 } + \use_i:nnnn + { \@@_step_fp:wwwN #1#2\@@_sep: #3#4\@@_sep: #5#6\@@_sep: #7 } \prg_break_point: \use:n { - \@@_error:nfff { step-tuple } { \fp_to_tl:n { #1#2 ; } } - { \fp_to_tl:n { #3#4 ; } } { \fp_to_tl:n { #5#6 ; } } + \@@_error:nfff { step-tuple } { \fp_to_tl:n { #1#2 \@@_sep: } } + { \fp_to_tl:n { #3#4 \@@_sep: } } { \fp_to_tl:n { #5#6 \@@_sep: } } } } -\cs_new:Npn \@@_step_fp:wwwN #1 ; \s_@@ \@@_chk:w #2#3#4 ; #5; #6 +\cs_new:Npn \@@_step_fp:wwwN + #1 \@@_sep: \s_@@ \@@_chk:w #2#3#4 \@@_sep: #5\@@_sep: #6 { \token_if_eq_meaning:NNTF #2 1 { @@ -456,11 +458,15 @@ } { \@@_error:nnfn { bad-step } { } - { \fp_to_tl:n { \s_@@ \@@_chk:w #2#3#4 ; } } {#6} + { \fp_to_tl:n { \s_@@ \@@_chk:w #2#3#4 \@@_sep: } } {#6} } \use_none:nnnnn } - { #1 ; } { \c_nan_fp } { \s_@@ \@@_chk:w #2#3#4 ; } { #5 ; } #6 + { #1 \@@_sep: } + { \c_nan_fp } + { \s_@@ \@@_chk:w #2#3#4 \@@_sep: } + { #5 \@@_sep: } + #6 } \cs_new:Npn \@@_step:NnnnnN #1#2#3#4#5#6 { @@ -556,8 +562,8 @@ \exp_after:wN \@@_minmax_loop:Nww \exp_after:wN - \fi: #2 - \s_@@ \@@_chk:w 2 #1 \s_@@_exact ; - \s_@@ \@@_chk:w { 3 \@@_minmax_break_o:w } ; + \s_@@ \@@_chk:w 2 #1 \s_@@_exact \@@_sep: + \s_@@ \@@_chk:w { 3 \@@_minmax_break_o:w } \@@_sep: } % \end{macrocode} % \end{macro} @@ -574,7 +580,7 @@ % maximum; otherwise we keep the first number. Then loop. % \begin{macrocode} \cs_new:Npn \@@_minmax_loop:Nww - #1 \s_@@ \@@_chk:w #2#3; \s_@@ \@@_chk:w #4#5; + #1 \s_@@ \@@_chk:w #2#3\@@_sep: \s_@@ \@@_chk:w #4#5\@@_sep: { \if_meaning:w 3 #4 \if_meaning:w 3 #2 @@ -585,8 +591,8 @@ \else: \if_int_compare:w \@@_compare_back:ww - \s_@@ \@@_chk:w #4#5; - \s_@@ \@@_chk:w #2#3; + \s_@@ \@@_chk:w #4#5\@@_sep: + \s_@@ \@@_chk:w #2#3\@@_sep: = #1 1 \exp_stop_f: \@@_minmax_auxii:ww \else: @@ -594,8 +600,8 @@ \fi: \fi: \@@_minmax_loop:Nww #1 - \s_@@ \@@_chk:w #2#3; - \s_@@ \@@_chk:w #4#5; + \s_@@ \@@_chk:w #2#3\@@_sep: + \s_@@ \@@_chk:w #4#5\@@_sep: } % \end{macrocode} % \end{macro} @@ -603,9 +609,10 @@ % \begin{macro}[EXP]{\@@_minmax_auxi:ww, \@@_minmax_auxii:ww} % Keep the first/second number, and remove the other. % \begin{macrocode} -\cs_new:Npn \@@_minmax_auxi:ww #1 \fi: \fi: #2 \s_@@ #3 ; \s_@@ #4; - { \fi: \fi: #2 \s_@@ #3 ; } -\cs_new:Npn \@@_minmax_auxii:ww #1 \fi: \fi: #2 \s_@@ #3 ; +\cs_new:Npn \@@_minmax_auxi:ww + #1 \fi: \fi: #2 \s_@@ #3 \@@_sep: \s_@@ #4\@@_sep: + { \fi: \fi: #2 \s_@@ #3 \@@_sep: } +\cs_new:Npn \@@_minmax_auxii:ww #1 \fi: \fi: #2 \s_@@ #3 \@@_sep: { \fi: \fi: #2 } % \end{macrocode} % \end{macro} @@ -615,8 +622,8 @@ % to the end of the tests, close the current test with \cs{fi:}, clean % up, and return the appropriate number with one post-expansion. % \begin{macrocode} -\cs_new:Npn \@@_minmax_break_o:w #1 \fi: \fi: #2 \s_@@ #3; #4; - { \fi: \@@_exp_after_o:w \s_@@ #3; } +\cs_new:Npn \@@_minmax_break_o:w #1 \fi: \fi: #2 \s_@@ #3\@@_sep: #4\@@_sep: + { \fi: \@@_exp_after_o:w \s_@@ #3\@@_sep: } % \end{macrocode} % \end{macro} % @@ -627,7 +634,7 @@ % 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:Npn \@@_not_o:w #1 \s_@@ \@@_chk:w #2#3; @ +\cs_new:Npn \@@_not_o:w #1 \s_@@ \@@_chk:w #2#3\@@_sep: @ { \if_meaning:w 0 #2 \exp_after:wN \exp_after:wN \exp_after:wN \c_one_fp @@ -652,30 +659,31 @@ \group_begin: \char_set_catcode_letter:N & \char_set_catcode_letter:N | - \cs_new:Npn \@@_&_o:ww #1 \s_@@ \@@_chk:w #2#3; + \cs_new:Npn \@@_&_o:ww #1 \s_@@ \@@_chk:w #2#3\@@_sep: { \if_meaning:w 0 #2 #1 - \@@_and_return:wNw \s_@@ \@@_chk:w #2#3; + \@@_and_return:wNw \s_@@ \@@_chk:w #2#3\@@_sep: \fi: \@@_exp_after_o:w } - \cs_new:Npn \@@_&_tuple_o:ww #1 \s_@@ \@@_chk:w #2#3; + \cs_new:Npn \@@_&_tuple_o:ww #1 \s_@@ \@@_chk:w #2#3\@@_sep: { \if_meaning:w 0 #2 #1 - \@@_and_return:wNw \s_@@ \@@_chk:w #2#3; + \@@_and_return:wNw \s_@@ \@@_chk:w #2#3\@@_sep: \fi: \@@_exp_after_tuple_o:w } - \cs_new:Npn \@@_tuple_&_o:ww #1; { \@@_exp_after_o:w } - \cs_new:Npn \@@_tuple_&_tuple_o:ww #1; { \@@_exp_after_tuple_o:w } + \cs_new:Npn \@@_tuple_&_o:ww #1\@@_sep: { \@@_exp_after_o:w } + \cs_new:Npn \@@_tuple_&_tuple_o:ww #1\@@_sep: { \@@_exp_after_tuple_o:w } \cs_new:Npn \@@_|_o:ww { \@@_&_o:ww \else: } \cs_new:Npn \@@_|_tuple_o:ww { \@@_&_tuple_o:ww \else: } - \cs_new:Npn \@@_tuple_|_o:ww #1; #2; { \@@_exp_after_tuple_o:w #1; } - \cs_new:Npn \@@_tuple_|_tuple_o:ww #1; #2; - { \@@_exp_after_tuple_o:w #1; } + \cs_new:Npn \@@_tuple_|_o:ww #1\@@_sep: #2\@@_sep: + { \@@_exp_after_tuple_o:w #1\@@_sep: } + \cs_new:Npn \@@_tuple_|_tuple_o:ww #1\@@_sep: #2\@@_sep: + { \@@_exp_after_tuple_o:w #1\@@_sep: } \group_end: -\cs_new:Npn \@@_and_return:wNw #1; \fi: #2; - { \fi: \@@_exp_after_o:w #1; } +\cs_new:Npn \@@_and_return:wNw #1\@@_sep: \fi: #2\@@_sep: + { \fi: \@@_exp_after_o:w #1\@@_sep: } % \end{macrocode} % \end{macro} % \end{macro} |