diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx index 72a176191ad..556b1960fdd 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx @@ -314,6 +314,41 @@ % % ^^A todo: This macro is intermingled with l3fp-parse. % ^^A todo: Add explanations. +% \begin{macro}[aux,EXP]{\@@_round_o:Nw} +% This function expects one or two arguments. +% \begin{macrocode} +\cs_new:Npn \@@_round_o:Nw #1#2 @ + { + \if_case:w + \__int_eval:w \@@_array_count:n {#2} - \c_one \__int_eval_end: + \@@_round:Nwn #1 #2 {0} \tex_romannumeral:D + \or: \@@_round:Nww #1 #2 \tex_romannumeral:D + \else: + \@@_error:nffn { num-args } + { \@@_round_name_from_cs:N #1 () } { 1 } { 2 } + \exp_after:wN \c_nan_fp \tex_romannumeral:D + \fi: + -`0 + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[aux, EXP]{\@@_round_name_from_cs:N} +% \begin{macrocode} +\cs_new:Npn \@@_round_name_from_cs:N #1 + { + \cs_if_eq:NNTF #1 \@@_round_to_zero:NNN { trunc } + { + \cs_if_eq:NNTF #1 \@@_round_to_ninf:NNN { floor } + { + \cs_if_eq:NNTF #1 \@@_round_to_pinf:NNN { ceil } + { round } + } + } + } +% \end{macrocode} +% \end{macro} +% % \begin{macro}[int, EXP]{\@@_round:Nww, \@@_round:Nwn} % \begin{macro}[aux, EXP] % { @@ -330,8 +365,9 @@ { \@@_small_int:wTF #3; { \@@_round:Nwn #1#2; } { - \@@_invalid_operation_tl_o:nf - { round } { \@@_array_to_clist:n { #2; #3; } } + \@@_invalid_operation_tl_o:ff + { \@@_round_name_from_cs:N #1 } + { \@@_array_to_clist:n { #2; #3; } } } } \cs_new:Npn \@@_round:Nwn #1 \s_@@ \@@_chk:w #2#3#4; #5 |