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 | 44 |
1 files changed, 19 insertions, 25 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx index 68df5e1ac17..b14d3e1058f 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx @@ -35,7 +35,7 @@ %% % %<*driver> -\RequirePackage{l3names} +\RequirePackage{l3bootstrap} \GetIdInfo$Id: l3fp-round.dtx 3549 2012-03-13 20:54:30Z bruno $ {L3 Floating-point rounding} \documentclass[full]{l3doc} @@ -119,8 +119,6 @@ % \begin{itemize} % \item \cs{@@_round:NNN} \meta{sign} \meta{digit_1} \meta{digit_2} % can expand to \cs{c_zero} or \cs{c_one}. -% \item \cs{@@_round:NNNN} \meta{sign} \meta{digit_1} \meta{digit_2} -% \meta{digit_3} can expand to \cs{c_zero} or \cs{c_one}. % \item \cs{@@_round_s:NNNw} \meta{sign} \meta{digit_1} \meta{digit_2} % \meta{more digits} |;| can expand to |\c_zero ;| or |\c_one ;|. % \item \cs{@@_round_neg:NNN} \meta{sign} \meta{digit_1} \meta{digit_2} @@ -234,27 +232,26 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[int, EXP]{\@@_round:NNNN} +% \begin{macro}[int, EXP]{\@@_round_digit:Nw} % \begin{syntax} -% \cs{@@_round:NNNN} \meta{final sign} \meta{digit} \meta{2d} +% \cs{__int_value:w} \cs{@@_round_digit:Nw} \meta{digit} \meta{intexpr} |;| % \end{syntax} -% Identical to \cs{@@_round_s:NNNw} except for a trailing semicolon. -% \begin{macrocode} -\cs_new:Npn \@@_round:NNNN #1 #2 #3 #4 +% This function should always be called within an \cs{__int_value:w} +% or \cs{__int_eval:w} expansion; it may add an extra +% \cs{__int_eval:w}, which means that the integer or integer +% expression should not be ended with a synonym of \tn{relax}, but +% with a semi-colon for instance. +% \begin{macrocode} +\cs_new:Npn \@@_round_digit:Nw #1 #2; { - \exp_after:wN \@@_round:NNN - \exp_after:wN #1 - \exp_after:wN #2 - \int_use:N \__int_eval:w - \if_int_odd:w 0 \if_meaning:w 0 #3 1 \fi: - \if_meaning:w 5 #3 1 \fi: - \exp_stop_f: - \if_int_compare:w #4 > \c_zero - 1 + - \fi: + \if_int_odd:w \if_meaning:w 0 #1 \c_one \else: + \if_meaning:w 5 #1 \c_one \else: + \c_zero \fi: \fi: + \if_int_compare:w \__int_eval:w #2 > \c_zero + \__int_eval:w \c_one + \fi: - #3 - \__int_eval_end: + \fi: + #1 } % \end{macrocode} % \end{macro} @@ -332,10 +329,7 @@ \cs_new:Npn \@@_round:Nww #1#2 ; #3 ; { \@@_small_int:wTF #3; { \@@_round:Nwn #1#2; } - { - \@@_error:x { {round(x,n)~with~n=} \@@_to_tl:w #3; } - \exp_after:wN \c_nan_fp - } + { \@@_array_invalid_operation_o:nw { round } #2; #3; @ } } \cs_new:Npn \@@_round:Nwn #1 \s_@@ \@@_chk:w #2#3#4; #5 { @@ -421,4 +415,4 @@ % % \PrintChanges % -% \PrintIndex
\ No newline at end of file +% \PrintIndex |