diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/l3experimental/l3str/l3str-format.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3experimental/l3str/l3str-format.dtx | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-format.dtx b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-format.dtx index c8dd27cd1e4..4244d7ae570 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-format.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-format.dtx @@ -22,7 +22,7 @@ % %<*driver|package> \RequirePackage{expl3} -\GetIdInfo$Id: l3str-format.dtx 6805 2016-12-28 22:15:52Z joseph $ +\GetIdInfo$Id: l3str-format.dtx 6948 2017-02-18 14:50:25Z bruno $ {L3 Experimental string formatting} %</driver|package> %<*driver> @@ -196,7 +196,7 @@ % \begin{macrocode} \prg_new_conditional:Npnn \@@_if_digit:N #1 { TF } { - \if_int_compare:w \c_nine < 1 #1 \exp_stop_f: + \if_int_compare:w 9 < 1 #1 \exp_stop_f: \prg_return_true: \else: \prg_return_false: \fi: } % \end{macrocode} @@ -385,9 +385,9 @@ { \prg_replicate:nn { - \int_max:nn \c_zero - { #3 - \__str_count:n { #2 #1 } - \c_one } - / \c_two + \int_max:nn { 0 } + { #3 - \__str_count:n { #2 #1 } - 1 } + / 2 } {#4} } @@ -395,9 +395,9 @@ { \prg_replicate:nn { - \int_max:nn \c_zero + \int_max:nn { 0 } { #3 - \__str_count:n { #2 #1 } } - / \c_two + / 2 } {#4} } @@ -632,7 +632,7 @@ \token_if_eq_charcode:NNTF #2 ? { \@@_put:nw { #1 > } } { \@@_put:nw { #1 #2 } } - \int_compare:nNnTF {#7} < \c_zero + \int_compare:nNnTF {#7} < 0 { \@@_put:nw { - } } { \str_case:nnF {#3} @@ -831,9 +831,9 @@ { \@@_put:fw { \int_eval:n { #3 - 1 } } \@@_put:nw { e } - \int_compare:nNnTF {#8} > \c_sixteen + \int_compare:nNnTF {#8} > \c__fp_prec_int { - \@@_put:fw { \prg_replicate:nn { #8 - \c_fifteen } {0} } + \@@_put:fw { \prg_replicate:nn { #8 - \c__fp_prec_int + 1 } {0} } \@@_put:fw { \use_none:n #4#5#6#7 } } { @@ -881,6 +881,7 @@ % % \begin{macro}[aux, EXP]{\@@_fp_g:wn} % \begin{macro}[aux, EXP]{\@@_fp_g_aux:wn} +% \begin{macro}[aux, EXP]{\@@_fp_to_scientific:n, \@@_fp_trim:w} % With the |g| type, first filter out special cases. In the normal % case, round to |#4| significant figures, then test the exponent: if % $-4\leq \meta{exponent} < \meta{precision}$, use the presentation @@ -909,14 +910,20 @@ \cs_new:Npn \@@_fp_g_aux:wn #1; #2 { \int_compare:nNnTF { \__fp_exponent:w #1; } < { -3 } - { \fp_to_scientific:n } + { \@@_to_scientific:n } { \int_compare:nNnTF { \__fp_exponent:w #1; } > {#2} - { \fp_to_scientific:n } + { \@@_to_scientific:n } { \fp_to_decimal:n } } { \__fp_set_sign_o:w 0 #1; @ \prg_do_nothing: } } +\cs_new:Npn \@@_to_scientific:n + { + \exp_after:wN \@@_fp_trim:w + \exp:w \exp_end_continue_f:w \fp_to_scientific:n + } +\cs_new:Npn \@@_fp_trim:w #1 e { \__fp_trim_zeros:w #1 ; e } % \end{macrocode} % \end{macro} % \end{macro} |