From 3301423440393adfdbbcfa0d8471e4b4c63df1e6 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 31 Aug 2012 17:58:55 +0000 Subject: l3kernel 3160 (31aug12) git-svn-id: svn://tug.org/texlive/trunk@27559 c570f23f-e606-0410-a88d-b1316a301751 --- .../source/latex/l3kernel/l3fp-logic.dtx | 96 ++++++++++++++++++++-- 1 file changed, 88 insertions(+), 8 deletions(-) (limited to 'Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx') diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx index 9813509686d..20f94e2abe4 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx @@ -205,7 +205,7 @@ % \end{macro} % % \begin{macro}[int, EXP]{\@@_compare_npos:nwnw} -% \begin{macro}[aux, EXP]{\@@_compare_mantissa:nnnnnnnn} +% \begin{macro}[aux, EXP]{\@@_compare_significand:nnnnnnnn} % \begin{quote} % \cs{@@_compare_npos:nwnw} % \Arg{expo_1} \meta{body_1} |;| @@ -215,7 +215,7 @@ % this expands to $0$ if the two numbers are equal, $-1$ if the first % is smaller, and $1$ if the first is bigger. First compare the % exponents: the larger one denotes the larger number. If they are -% equal, we must compare mantissas. If both the first $8$ digits and +% equal, we must compare significands. If both the first $8$ digits and % the next $8$ digits coincide, the numbers are equal. If only the % first $8$ digits coincide, the next $8$ decide. Otherwise, the % first $8$ digits are compared. @@ -223,12 +223,12 @@ \cs_new:Npn \@@_compare_npos:nwnw #1#2; #3#4; { \if_int_compare:w #1 = #3 \exp_stop_f: - \@@_compare_mantissa:nnnnnnnn #2 #4 + \@@_compare_significand:nnnnnnnn #2 #4 \else: \if_int_compare:w #1 < #3 - \fi: 1 \fi: } -\cs_new:Npn \@@_compare_mantissa:nnnnnnnn #1#2#3#4#5#6#7#8 +\cs_new:Npn \@@_compare_significand:nnnnnnnn #1#2#3#4#5#6#7#8 { \if_int_compare:w #1#2 = #5#6 \exp_stop_f: \if_int_compare:w #3#4 = #7#8 \exp_stop_f: @@ -244,6 +244,86 @@ % \end{macro} % \end{macro} % +% \subsection{Floating point expression loops} +% +% \begin{macro}[rEXP] +% { +% \fp_do_until:nn, \fp_do_while:nn, +% \fp_until_do:nn, \fp_while_do:nn +% } +% These are quite easy given the above functions. The |do_until| and +% |do_while| versions execute the body, then test. The |until_do| and +% |while_do| do it the other way round. +% \begin{macrocode} +\cs_new:Npn \fp_do_until:nn #1#2 + { + #2 + \fp_compare:nF {#1} + { \fp_do_until:nn {#1} {#2} } + } +\cs_new:Npn \fp_do_while:nn #1#2 + { + #2 + \fp_compare:nT {#1} + { \fp_do_while:nn {#1} {#2} } + } +\cs_new:Npn \fp_until_do:nn #1#2 + { + \fp_compare:nF {#1} + { + #2 + \fp_until_do:nn {#1} {#2} + } + } +\cs_new:Npn \fp_while_do:nn #1#2 + { + \fp_compare:nT {#1} + { + #2 + \fp_while_do:nn {#1} {#2} + } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[rEXP] +% { +% \fp_do_until:nNnn, \fp_do_while:nNnn, +% \fp_until_do:nNnn, \fp_while_do:nNnn +% } +% As above but not using the |nNn| syntax. +% \begin{macrocode} +\cs_new:Npn \fp_do_until:nNnn #1#2#3#4 + { + #4 + \fp_compare:nNnF {#1} #2 {#3} + { \fp_do_until:nNnn {#1} #2 {#3} {#4} } + } +\cs_new:Npn \fp_do_while:nNnn #1#2#3#4 + { + #4 + \fp_compare:nNnT {#1} #2 {#3} + { \fp_do_while:nNnn {#1} #2 {#3} {#4} } + } +\cs_new:Npn \fp_until_do:nNnn #1#2#3#4 + { + \fp_compare:nNnF {#1} #2 {#3} + { + #4 + \fp_until_do:nNnn {#1} #2 {#3} {#4} + } + } +\cs_new:Npn \fp_while_do:nNnn #1#2#3#4 + { + \fp_compare:nNnT {#1} #2 {#3} + { + #4 + \fp_while_do:nNnn {#1} #2 {#3} {#4} + } + } +% \end{macrocode} +% \end{macro} +% % \subsection{Extrema} % % \begin{macro}[int, EXP]{\@@_max_o:w, \@@_min_o:w} @@ -403,7 +483,7 @@ \@@_ternary_break_point:n { \exp_after:wN \@@_ternary_i:NwwN } \exp_after:wN #1 \tex_romannumeral:D -`0 - \@@_parse_exp_after_array:wf #3 \s_@@_stop + \@@_exp_after_array_f:w #3 \s_@@_stop \exp_after:wN @ \tex_romannumeral:D \@@_parse_until:Nw \c_two @@ -414,7 +494,7 @@ \exp_after:wN \@@_parse_until_test:NwN \exp_after:wN #1 \tex_romannumeral:D -`0 - \@@_parse_exp_after_array:wf #3 \s_@@_stop + \@@_exp_after_array_f:w #3 \s_@@_stop \exp_after:wN #4 \exp_after:wN #1 \fi: @@ -437,7 +517,7 @@ \exp_after:wN \@@_parse_until_test:NwN \exp_after:wN #1 \tex_romannumeral:D -`0 - \@@_parse_exp_after_array:wf #2 \s_@@_stop + \@@_exp_after_array_f:w #2 \s_@@_stop #4 #1 } \cs_new:Npn \@@_ternary_ii:NwwN #1#2@#3@#4 @@ -445,7 +525,7 @@ \exp_after:wN \@@_parse_until_test:NwN \exp_after:wN #1 \tex_romannumeral:D -`0 - \@@_parse_exp_after_array:wf #3 \s_@@_stop + \@@_exp_after_array_f:w #3 \s_@@_stop #4 #1 } % \end{macrocode} -- cgit v1.2.3