diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx | 70 |
1 files changed, 69 insertions, 1 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx index 40691eeeff3..68282396cce 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx @@ -36,7 +36,7 @@ % %<*driver> \documentclass[full]{l3doc} -\GetIdInfo$Id: l3fp-logic.dtx 6659 2016-08-15 15:37:48Z bruno $ +\GetIdInfo$Id: l3fp-logic.dtx 6759 2016-11-21 17:04:08Z joseph $ {L3 Floating-point conditionals} \begin{document} \DocInput{\jobname.dtx} @@ -316,6 +316,74 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}[EXP]{\fp_step_function:nnnN, \fp_step_function:nnnc} +% \begin{macro}[EXP, aux]{\@@_step:wwwN} +% \begin{macro}[EXP, aux]{\@@_step:NnnnN, \@@_step:NfnnN} +% The approach here is much the same as \cs{int_step_function:nnnN} except we +% do not have a convenient low-level way to evaluation each argument to give +% a pure number. Instead, the internal parser is used to leave values in the +% internal format (and avoid a more expensive \texttt{f}-type expansion of +% multiple uses of \texttt{fp_eval:n}). +% \begin{macrocode} +\cs_new:Npn \fp_step_function:nnnN #1#2#3 + { + \exp_after:wN \@@_step:wwwN + \exp:w \exp_end_continue_f:w \@@_parse_o:n {#1} : + \exp:w \exp_end_continue_f:w \@@_parse_o:n {#2} : + \exp:w \exp_end_continue_f:w \@@_parse:n {#3} : + } +\cs_generate_variant:Nn \fp_step_function:nnnN { nnnc } +% \end{macrocode} +% Here, |#1| will be passed to the output on the first pass of the loop. +% To avoid this being in internal form, an \texttt{f}-type expansion is used +% here on that value only. The second and third arguments will be converted +% during the loop itself. +% \begin{macrocode} +\cs_new:Npn \@@_step:wwwN #1 : #2 : #3 : #4 + { + \fp_compare:nNnTF {#2} > 0 + { \@@_step:NfnnN > } + { + \fp_compare:nNnTF {#2} = 0 + { + \__msg_kernel_expandable_error:nnn { kernel } { zero-step } {#4} + \use_none:nnnn + } + { \@@_step:NfnnN < } + } + { \fp_eval:n {#1} } {#2} {#3} #4 + } + +\cs_new:Npn \@@_step:NnnnN #1#2#3#4#5 + { + \fp_compare:nNnF {#2} #1 {#4} + { + #5 {#2} + \@@_step:NfnnN + #1 { \fp_eval:n { #2 + #3 } } {#3} {#4} #5 + } + } +\cs_generate_variant:Nn \@@_step:NnnnN { Nf } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \begin{macro}{\fp_step_inline:nnnn} +% As for \cs{int_step_inline:nnnn}, create a global function and apply it, +% following up with a break point. +% \begin{macrocode} +\cs_new_protected:Npn \fp_step_inline:nnnn #1#2#3#4 + { + \int_gincr:N \g__prg_map_int + \cs_gset_protected:cpn { __prg_map_ \int_use:N \g__prg_map_int :w } + ##1 {#4} + \fp_step_function:nnnc {#1} {#2} {#3} + { __prg_map_ \int_use:N \g__prg_map_int :w } + \__prg_break_point:Nn \scan_stop: { \int_gdecr:N \g__prg_map_int } + } +% \end{macrocode} +% \end{macro} +% % \subsection{Extrema} % % \begin{macro}[int, EXP]{\@@_minmax_o:Nw} |